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

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed Jul 3 07:58:59 MDT 2013


On Tue, Jul 02, 2013 at 12:26:59PM -0700, Jeremy Allison wrote:
> On Mon, Jul 01, 2013 at 01:02:44PM +0200, Andreas Schneider wrote:
> > Signed-off-by: Andreas Schneider <asn at samba.org>
> > ---
> >  source4/torture/smb2/session.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/source4/torture/smb2/session.c b/source4/torture/smb2/session.c
> > index 9592b5e..6901f47 100644
> > --- a/source4/torture/smb2/session.c
> > +++ b/source4/torture/smb2/session.c
> > @@ -863,7 +863,7 @@ static bool test_session_expire1(struct torture_context *tctx)
> >  	const char *host = torture_setting_string(tctx, "host", NULL);
> >  	const char *share = torture_setting_string(tctx, "share", NULL);
> >  	struct cli_credentials *credentials = cmdline_credentials;
> > -	struct smb2_tree *tree;
> > +	struct smb2_tree *tree = NULL;
> >  	enum credentials_use_kerberos use_kerberos;
> >  	char fname[256];
> >  	struct smb2_handle _h1;
> > -- 
> > 1.8.3.1
> 
> I'm reviewing these..
> 
> FYI. Most of these come from failing to initialize auto
> variables on declaration.

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.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list