#137 "strncmp" should not be used to match header names

ver devel
closed-fixed
core (32)
5
2009-01-06
2008-10-27
No

All those results are bugs since they expect header names being case sensitive
while SIP syntax is case insensitive in header names:

/usr/src/kamailio-trunk$ grep -ri "strncmp(h" * | grep -v svn
sources/modules/peering/verify.c: if (strncmp(hf->name.s, "P-Request-Hash",
sources/modules/pua_bla/notify.c: if(strncmp(hdr->name.s, "Subscription-State",18)==0 )
sources/modules/rls/subscribe.c: if(strncmp(hdr->name.s, "Support", 7)== 0)
sources/modules/rls/subscribe.c: if(strncmp(hdr->body.s+ i, "eventlist", 9)== 0)
sources/modules/rls/resource_notify.c: if(strncmp(hdr->name.s, "Subscription-State", 18)==0)
sources/modules/pua_mi/mi_func.c: if(strncmp(hdr->name.s, "SIP-ETag",8)==0 )
sources/modules/pua/send_publish.c: if(strncmp(hdr->name.s, "SIP-ETag",8)==0 )
sources/modules/pua_xmpp/simple2xmpp.c: if(strncmp(hdr->name.s, "Subscription-State",18)==0 )
sources/modules/pua_xmpp/simple2xmpp.c: if(strncmp(hdr->name.s, "Subscription-State",18)==0 )
sources/modules/pua_xmpp/simple2xmpp.c: if(hdr && strncmp(hdr->body.s,"terminated", 10)== 0)
sources/modules/presence/publish.c: if(strncmp(hdr->name.s, "SIP-If-Match",12)==0||
sources/modules/presence/publish.c: strncmp(hdr->name.s,"Sip-If-Match",12)==0 )
sources/msg_translator.c: if (he && (strncmp(he->h_name, name->s, name->len)==0))
sources/msg_translator.c: if (strncmp(he->h_aliases[i],name->s, name->len)==0)

Discussion

    • assigned_to: nobody --> miconda
    • status: open --> closed-fixed
     
  • Trunk is using a dedicated function to match header names by string comparison. If there is some left, please re-open and point the file.