]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
examples: Make sure the array is probably initialized
authorAndreas Schneider <asn@samba.org>
Thu, 20 Jun 2024 07:12:22 +0000 (09:12 +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/examples/libsmbclient/testacl2.c:27: var_decl: Declaring variable ""value"" without initializer.
samba-4.20.0rc2/examples/libsmbclient/testacl2.c:48: uninit_use_in_call: Using uninitialized value ""*value"" as argument to ""%s"" when calling ""printf"". [Note: The source code implementation of the function has been overridden by a builtin model.]
   46|    }
   47|
   48|->  printf(""Attributes for [%s] are:\n%s\n"", argv[1], value);
   49|
   50|    flags = 0;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
examples/libsmbclient/testacl2.c

index ee48b7b30594432b3858fa5b1b1916c9093fd2e4..ae9a76b511899b5814116c2cb8f605fc99a7fb46 100644 (file)
@@ -24,7 +24,7 @@ int main(int argc, const char *argv[])
        static char *the_acl = NULL;
        int ret;
        const char *debugstr;
-       char value[1024];
+       char value[1024] = {0};
        SMBCCTX *context;
 
        if (smbc_init(get_auth_data_fn, debug) != 0)