From 7b38387e27ccf0183b51ba8a4ba9cd31a4ea85bb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 29 Dec 2024 11:49:35 +0100 Subject: [PATCH] torture4: Simplification with generate_random_str_list_buf() No NULL check required Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source4/torture/rpc/samba3rpc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 84561de7b99..ac394199eab 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -2094,7 +2094,7 @@ static bool torture_samba3_rpc_randomauth2(struct torture_context *torture) TALLOC_CTX *mem_ctx; struct dcerpc_pipe *net_pipe; struct dcerpc_binding_handle *net_handle; - char *wksname; + char wksname[15]; bool result = false; NTSTATUS status; struct netr_ServerReqChallenge r; @@ -2112,11 +2112,9 @@ static bool torture_samba3_rpc_randomauth2(struct torture_context *torture) return false; } - if (!(wksname = generate_random_str_list( - mem_ctx, 14, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"))) { - torture_comment(torture, "generate_random_str_list failed\n"); - goto done; - } + generate_random_str_list_buf(wksname, + sizeof(wksname), + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); if (!(torture_open_connection_share( mem_ctx, &cli, -- 2.47.3