[asterisk-dev] Yes. (Was: does get_header() in chan_sip returns a null-terminated buffer?)

Steve Underwood steveu at coppice.org
Thu Oct 23 13:21:33 CDT 2008


Klaus Darilion wrote:
> Russell Bryant schrieb:
>   
>> Klaus Darilion wrote:
>>     
>>> thanks
>>>       
>> You're welcome!
>>     
>
> I just wondered why this patch was added from 1.4.21.2 to 1.4.22 in 
> chan_sip.c
>
>
> @@ -4919,7 +4937,7 @@
>          content_type = get_header(req, "Content-Type");
>
>          /* if the body contains only SDP, this is easy */
> -       if (!strcasecmp(content_type, "application/sdp")) {
> +       if (!strncasecmp(content_type, "application/sdp", 15)) {
>                  req->sdp_start = 0;
>                  req->sdp_end = req->lines;
>                  return req->lines ? 1 : 0;
>
> thanks
> Klaus
>
> PS: Is there an easy way to find the corresponding commit (to read the 
> commit comment)?
>   
I guess that is because its perfectly valid to have things after 
application/sdp. The change is a bit nasty, though, as it doesn't check 
for things like application/sdpmark2. Only things like 
application/sdp;charset=utf8 should be accepted. I'm amazed * got away 
for so long without fixing that, as a few things add a charset field there.

Regards,
Steve




More information about the asterisk-dev mailing list