s4:torture: Make sure handles are initialized
authorAndreas Schneider <asn@samba.org>
Thu, 16 Feb 2017 16:52:41 +0000 (17:52 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 23 Feb 2017 02:18:10 +0000 (03:18 +0100)
The CHECK_STATUS macro might goto done which checks the values of the
handle so they should be initialized in this case.

Found by covscan.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12592

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/torture/smb2/rename.c

index 1a490f31240646a414097c922e03a3a7c49e0b42..96526435e46766997d004cb8127e93b53bf719fc 100644 (file)
@@ -57,6 +57,8 @@ static bool torture_smb2_rename_simple(struct torture_context *torture,
        union smb_fileinfo fi;
        struct smb2_handle h1;
 
+       ZERO_STRUCT(h1);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);
 
@@ -145,6 +147,8 @@ static bool torture_smb2_rename_simple2(struct torture_context *torture,
        union smb_setfileinfo sinfo;
        struct smb2_handle h1;
 
+       ZERO_STRUCT(h1);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);
 
@@ -226,6 +230,8 @@ static bool torture_smb2_rename_no_sharemode(struct torture_context *torture,
        union smb_fileinfo fi;
        struct smb2_handle h1;
 
+       ZERO_STRUCT(h1);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);
 
@@ -314,6 +320,9 @@ static bool torture_smb2_rename_with_delete_access(struct torture_context *tortu
        union smb_setfileinfo sinfo;
        struct smb2_handle fh, dh;
 
+       ZERO_STRUCT(fh);
+       ZERO_STRUCT(dh);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);
 
@@ -439,6 +448,9 @@ static bool torture_smb2_rename_with_delete_access2(struct torture_context *tort
        union smb_setfileinfo sinfo;
        struct smb2_handle fh, dh;
 
+       ZERO_STRUCT(fh);
+       ZERO_STRUCT(dh);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);
 
@@ -563,6 +575,9 @@ static bool torture_smb2_rename_no_delete_access(struct torture_context *torture
        union smb_fileinfo fi;
        struct smb2_handle fh, dh;
 
+       ZERO_STRUCT(fh);
+       ZERO_STRUCT(dh);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);
 
@@ -697,6 +712,9 @@ static bool torture_smb2_rename_no_delete_access2(struct torture_context *tortur
        union smb_setfileinfo sinfo;
        struct smb2_handle fh, dh;
 
+       ZERO_STRUCT(fh);
+       ZERO_STRUCT(dh);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);
 
@@ -820,6 +838,9 @@ static bool torture_smb2_rename_msword(struct torture_context *torture,
        union smb_fileinfo fi;
        struct smb2_handle fh, dh;
 
+       ZERO_STRUCT(fh);
+       ZERO_STRUCT(dh);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);
 
@@ -938,6 +959,9 @@ static bool torture_smb2_rename_dir_openfile(struct torture_context *torture,
        union smb_setfileinfo sinfo;
        struct smb2_handle d1, h1;
 
+       ZERO_STRUCT(d1);
+       ZERO_STRUCT(h1);
+
        smb2_deltree(tree1, BASEDIR);
        smb2_util_rmdir(tree1, BASEDIR);