Re: Segfault in HTCP CLR request on 64-bit

From: Adrian Chadd <adrian_at_squid-cache.org>
Date: Fri, 2 Oct 2009 15:30:22 +0800

The whole struct is on the local stack. Hence bzero() or memset() to 0.

2009/10/2 Matt W. Benjamin <matt_at_linuxbox.com>:
> Bzero?  Is it an already-allocated array/byte sequence?  (Apologies, I haven't seen the code.)  Assignment to NULL/0 is in fact correct for initializing a sole pointer, and using bzero for that certainly isn't typical.  Also, for initializing a byte range, memset is preferred [see Linux BZERO(3), which refers to POSIX.1-2008 on that point].
>
> STYLE(9) says use NULL rather than 0, and it is clearer.  But C/C++ programmers should know that NULL is 0.  And note that at least through 1998, initialization to 0 was the preferred style in C++, IIRC.
>
> Matt
>
> ----- "Adrian Chadd" <adrian_at_squid-cache.org> wrote:
>
>> I've just replied to the ticket in question. It should probably just
>> be a bzero() rather than setting the pointer to 0. Which should
>> really
>> be setting it to NULL.
>>
>> Anyway, please test whether the bzero() works. If it does then I'll
>> commit that fix to HEAD and 2.7.
>>
>> 2009/9/28 Jason Noble <jason_at_linuxbox.com>:
>> > I have opened a bug for this issue here:
>> http://bugs.squid-cache.org/show_bug.cgi?id=2788  Also, the previous
>> patch was not generated against head so I re-rolled the patch against
>> current head and attached to the bug report
>
> --
>
> Matt Benjamin
>
> The Linux Box
> 206 South Fifth Ave. Suite 150
> Ann Arbor, MI  48104
>
> http://linuxbox.com
>
> tel. 734-761-4689
> fax. 734-769-8938
> cel. 734-216-5309
>
>
Received on Fri Oct 02 2009 - 07:30:33 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 02 2009 - 12:00:04 MDT