[Asterisk-Dev] possible bug in chan_sip

Maurizio Marini maumar at datalogica.com
Thu Jan 13 09:03:17 MST 2005


On Thursday 13 January 2005 04:05 pm, Kevin P. Fleming wrote:
> You are correct, and this is probably the fix for bug 3077. Please make
> a regular "diff -u" patch and post it to that bug, and thanks for the
> catch! (I missed that when I wrote it).

i submitted my patch on:
http://bugs.digium.com/bug_view_page.php?bug_id=0003332

i suggest to use this solution, without using for loop:

--- chan_sip.c-old      2005-01-13 16:25:57.000000000 +0100
+++ chan_sip.c  2005-01-13 16:28:01.000000000 +0100
@@ -1135,14 +1135,10 @@

        tmp = var;
        while(tmp) {
-               if (strcasecmp(tmp->name, "type"))
-                       continue;
-
-               if (!strcasecmp(tmp->value, "user")) {
-                       ast_destroy_realtime(var);
-                       return NULL;
-               }
-
+                if (!strcasecmp(tmp->name, "type") && !strcasecmp(tmp->value, 
"user")) {
+                        ast_destroy_realtime(var);
+                        return NULL;
+                }
                tmp = tmp->next;
        }

@@ -1207,13 +1203,10 @@

        tmp = var;
        while (tmp) {
-               if (strcasecmp(tmp->name, "type"))
-                       continue;
-
-               if (!strcasecmp(tmp->value, "peer")) {
-                       ast_destroy_realtime(var);
-                       return NULL;
-               }
+                if (!strcasecmp(tmp->name, "type") && !strcasecmp(tmp->value, 
"peer")) {
+                        ast_destroy_realtime(var);
+                        return NULL;
+                }
                tmp = tmp->next;
        }

Maurizio



More information about the asterisk-dev mailing list