From 4777464946c16fb9d731e45a9ddb23a34c89d898 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 24 Jun 2024 10:09:43 +0200 Subject: [PATCH] s4:torture: Initialize struct nbt_name_query "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 Reviewed-by: Noel Power --- source4/torture/nbt/query.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source4/torture/nbt/query.c b/source4/torture/nbt/query.c index 707c2a52a78..6bdff3448cc 100644 --- a/source4/torture/nbt/query.c +++ b/source4/torture/nbt/query.c @@ -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);