]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Initialize struct smb2_handle
authorAndreas Schneider <asn@samba.org>
Thu, 20 Jun 2024 12:48:29 +0000 (14:48 +0200)
committerMartin Schwenke <martins@samba.org>
Sun, 30 Jun 2024 23:20:33 +0000 (23:20 +0000)
"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/smb2/lease.c:452: var_decl: Declaring variable ""h"" without initializer.
samba-4.20.0rc2/source4/torture/smb2/lease.c:516: uninit_use_in_call: Using uninitialized value ""h"" when calling ""smb2_util_close"".
  514|
  515|    done:
  516|->  smb2_util_close(tree, h);
  517|    smb2_util_close(tree, hnew);
  518|    smb2_util_close(tree, h2);"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
source4/torture/smb2/lease.c

index 9c54e753712380693b5a44aab2741215e3345df2..370f4224b133c75b10237ad13516b35095f8a82c 100644 (file)
@@ -454,7 +454,15 @@ static bool test_lease_upgrade3(struct torture_context *tctx,
                                 struct smb2_tree *tree)
 {
        TALLOC_CTX *mem_ctx = talloc_new(tctx);
-       struct smb2_handle h, h2, hnew;
+       struct smb2_handle h = {
+               .data = {0},
+       };
+       struct smb2_handle h2 = {
+               .data = {0},
+       };
+       struct smb2_handle hnew = {
+               .data = {0},
+       };
        NTSTATUS status;
        struct smb2_create io;
        struct smb2_lease ls;