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

Klaus Darilion klaus.mailinglists at pernau.at
Thu Oct 23 16:06:10 CDT 2008


Steve Underwood wrote:
> 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.

That makes sense. I just was afraid that maybe get_header() is not 
null-terminated anymore.

regards
klaus



More information about the asterisk-dev mailing list