]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Tue May 20 09:32:30 EDT 2008 Pekka.Pessi@nokia.com
authorMichael Jerris <mike@jerris.com>
Sun, 25 May 2008 14:57:14 +0000 (14:57 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 25 May 2008 14:57:14 +0000 (14:57 +0000)
  * sip_tag_class.c: fixed klocwork issues

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8614 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c

index ec0c4b1bfe4fd60c1c2ed9fe98d25e42f4a81c3b..11fed516ff6bff9658f3a35042123d1dbbe793a6 100644 (file)
@@ -1 +1 @@
-Sun May 25 09:56:21 EDT 2008
+Sun May 25 10:57:08 EDT 2008
index 70faeb033c5721334b50d14f4e37b3501b2e31e9..4c2aa3aba88e3f2fdec86c2469e81a0c77a7a61f 100644 (file)
@@ -158,7 +158,8 @@ tagi_t *siptag_filter(tagi_t *dst,
                        (msg_pub_t *)sip, hc);
 
     /* Is header present in the SIP message? */
-    if ((char *)hh >= ((char *)sip + sip->sip_size) ||
+    if (hh == NULL ||
+       (char *)hh >= ((char *)sip + sip->sip_size) ||
        (char *)hh < (char *)&sip->sip_request)
       return dst;
 
@@ -234,8 +235,12 @@ int sip_add_tagis(msg_t *msg, sip_t *sip, tagi_t const **inout_list)
 
       if (h == SIP_NONE) {     /* Remove header */
        hh = msg_hclass_offset(msg_mclass(msg), (msg_pub_t *)sip, hc);
-       while (*hh)
-         msg_header_remove(msg, (msg_pub_t *)sip, *hh);
+       if (hh != NULL &&
+           (char *)hh < ((char *)sip + sip->sip_size) &&
+           (char *)hh >= (char *)&sip->sip_request) {
+         while (*hh)
+           msg_header_remove(msg, (msg_pub_t *)sip, *hh);
+       }
        continue;
       } 
 
@@ -441,18 +446,21 @@ tagi_t *sip_url_query_as_taglist(su_home_t *home, char const *query,
     msg_hclass_t *hc = NULL;
 
     hnv = su_strlst_item(l, i);
-    n = strcspn(hnv, "=");
+    n = hnv ? strcspn(hnv, "=") : 0;
     if (n == 0)
       break;
 
     if (n == 4 && strncasecmp(hnv, "body", 4) == 0)
       t = siptag_payload, hc = sip_payload_class;
-    else for (j = 0; (t = sip_tag_list[j]); j++) {
-      hc = (msg_hclass_t *)sip_tag_list[j]->tt_magic;
-      if (n == 1 && strncasecmp(hnv, hc->hc_short, 1) == 0)
-       break;
-      else if (n == (size_t)hc->hc_len && strncasecmp(hnv, hc->hc_name, n) == 0)
-       break;
+    else {
+      for (j = 0; (t = sip_tag_list[j]); j++) {
+       hc = (msg_hclass_t *)sip_tag_list[j]->tt_magic;
+       if (n == 1 && strncasecmp(hnv, hc->hc_short, 1) == 0)
+         break;
+       else if (n == (size_t)hc->hc_len &&
+                strncasecmp(hnv, hc->hc_name, n) == 0)
+         break;
+      }
     }
 
     value = (char *)hnv + n;