[commit] r8614 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/sip
Author: mikej Date: Sun May 25 10:57:14 2008 New Revision: 8614 Modified: freeswitch/trunk/libs/sofia-sip/.update freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c Log: Tue May 20 09:32:30 EDT 2008 Pekka.Pessi@nokia.com * sip_tag_class.c: fixed klocwork issues Modified: freeswitch/trunk/libs/sofia-sip/.update ============================================================================== --- freeswitch/trunk/libs/sofia-sip/.update (original) +++ freeswitch/trunk/libs/sofia-sip/.update Sun May 25 10:57:14 2008 @@ -1 +1 @@ -Sun May 25 09:56:21 EDT 2008 +Sun May 25 10:57:08 EDT 2008 Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c ============================================================================== --- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c (original) +++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c Sun May 25 10:57:14 2008 @@ -158,7 +158,8 @@ (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 @@ 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 @@ 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;
participants (1)
-
Freeswitch SVN