[squid-dev] Http::One::Parser::getHeaderField bug
Tsantilas Christos
chtsanti at users.sourceforge.net
Wed Nov 19 14:29:06 UTC 2014
On 11/19/2014 02:45 PM, Amos Jeffries wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Did that fix solve the issue for you?
Yes, please commit to trunk!
>
> Amos
>
> On 13/11/2014 4:06 p.m., Amos Jeffries wrote:
>> On 13/11/2014 5:34 a.m., Tsantilas Christos wrote:
>>> The following patch is fixing it:
>>>
>>> === modified file 'src/http/one/Parser.cc' ---
>>> src/http/one/Parser.cc 2014-09-14 12:43:00 +0000 +++
>>> src/http/one/Parser.cc 2014-11-12 16:31:08 +0000 @@ -71,7
>>> +71,7 @@ p.chop(0, sizeof(header)-1);
>>>
>>> // return the header field-value - xstrncpy(header,
>>> p.rawContent(), p.length()); + strcpy(header, p.c_str());
>>
>> c_str() re-allocates. We can and need to avoid that here.
>>
>>> debugs(25, 5, "returning " << header); return header; }
>>>
>>>
>>> Does this looks like an SBuf bug?
>>
>> No. I think it was just me overlooking that xstrncpy() length
>> includes and enforces the '\0' termination.
>>
>> Use this: xstrncpy(header, p.rawContent(), p.length()+1);
>>
>> Amos
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.22 (MingW32)
>
> iQEcBAEBAgAGBQJUbJD/AAoJELJo5wb/XPRjfOEH+wW1/V7VlFnd+yRBax9dpui4
> mPFO753VOrV7KBA0juEpgNTgiYdpk7UM1BcVc3WDCG0tkUVc6Cn/b2vWZ87lzk+4
> aMcuavlYPwU6Pztr+tWx0Box6uTEt6XoOzErSM1hBWxRrnpgh8MYCWI1L/3ungJ8
> PgHwSb8oBDbjhqRFPqMoOqqtmsVEHR0dP+XBBmPmHXzna/zMsrDQylfgEnLHCNUY
> 3o5DfSgW/csiYIn81fnNvwVm70ZOB7aTWJQUBHvJoP5y0yQ/4LF8SqW5PrKNc8Zw
> r40zoM3TqFx7SjLNy63N4IUqwiLhqfrcTFWM5pgsNdWrha5sIJpYiHG6bNckHck=
> =NSil
> -----END PGP SIGNATURE-----
> _______________________________________________
> squid-dev mailing list
> squid-dev at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-dev
>
More information about the squid-dev
mailing list