Tue May 20 09:32:30 EDT 2008 Pekka.Pessi@nokia.com

* sip_tag_class.c: fixed klocwork issues


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8614 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-05-25 14:57:14 +00:00
parent 6a54b3ec07
commit 39e280f114
2 changed files with 19 additions and 11 deletions

View File

@ -1 +1 @@
Sun May 25 09:56:21 EDT 2008
Sun May 25 10:57:08 EDT 2008

View 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;