]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Initialize struct nbt_name_query
authorAndreas Schneider <asn@samba.org>
Mon, 24 Jun 2024 08:09:43 +0000 (10:09 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 28 Jun 2024 11:39:33 +0000 (11:39 +0000)
"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/nbt/query.c:53: var_decl: Declaring variable ""io"" without initializer.
samba-4.20.0rc2/source4/torture/nbt/query.c:76: uninit_use_in_call: Using uninitialized value ""io.in.retries"" when calling ""nbt_name_query_send"".
   74|    while (num_sent - (result->num_pass+result->num_fail) < 10) {
   75|    struct nbt_name_request *req;
   76|->  req = nbt_name_query_send(nbtsock, &io);
   77|    torture_assert(tctx, req != NULL, ""Failed to setup request!"");
   78|    req->async.fn = increment_handler;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source4/torture/nbt/query.c

index 707c2a52a78268041fdd8d69e1e9988931cd60b5..6bdff3448cc9f7e869af84c5b5de823d38d6f662 100644 (file)
@@ -50,7 +50,11 @@ static bool bench_namequery(struct torture_context *tctx)
        struct nbt_name_socket *nbtsock = torture_init_nbt_socket(tctx);
        int num_sent=0;
        struct result_struct *result;
-       struct nbt_name_query io;
+       struct nbt_name_query io = {
+               .in = {
+                       .retries = 0,
+               }
+       };
        struct timeval tv = timeval_current();
        int timelimit = torture_setting_int(tctx, "timelimit", 5);