[PATCH 3/7] torture: Don't segfault in smb2.session on error.

Jeremy Allison jra at samba.org
Wed Jul 3 10:12:38 MDT 2013


On Wed, Jul 03, 2013 at 05:54:14PM +0200, Volker Lendecke wrote:
> On Wed, Jul 03, 2013 at 08:51:20AM -0700, Jeremy Allison wrote:
> > On Wed, Jul 03, 2013 at 03:58:59PM +0200, Volker Lendecke wrote:
> > > 
> > > In particular the one that was discussed here already I
> > > would say that initializing the whole buffer would be
> > > unnecessary and would hide potential bugs in the smbcli_read
> > > call from valgrind. For many variables it makes sense to be
> > > initializes, but by far not for all, so a catch-all law to
> > > make everything initialized is going to far IMO. But that's
> > > just my 2ct.
> > 
> > Well I'm taking about initializing variables, not buffers.
> > I agree that's usually overkill and can hide valgrind bugs.
> 
> Well, in this case "buf" *is* a variable. An array, but
> still a local variable. Where do you draw the line?

Personally I draw the line at pointers. Initialize to
NULL if not meant to start pointing at anything, point
them at whatever they're meant to be pointing at if
they're meant to be pointing at something, but don't
null out the contents.

Jeremy


More information about the samba-technical mailing list