]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Fix NULL pointer dereference in lpcfg_set_cmdline
authorkshumikhina <ksen.shum@gmail.com>
Thu, 11 Jun 2026 14:23:08 +0000 (18:23 +0400)
committerVolker Lendecke <vl@samba.org>
Sat, 13 Jun 2026 09:25:05 +0000 (09:25 +0000)
If orig_share is NULL, the program will jump to the done label, where the
lpcfg_set_cmdline function will be called without any checks; within that
function, no checks are performed either, and orig_share will be dereferenced.

Added a check if (orig_share != NULL) before calling lpcfg_set_cmdline
in the cleanup block.

Pair-Programmed-With: Dmitry Mikhalchenko <tascad@altlinux.org>
Signed-off-by: Shumikhina Ksenia <shumikhinaka@sgu.ru>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Jun 13 09:25:05 UTC 2026 on atb-devel-224

source4/torture/smb2/lease.c

index 481a0b83f3943c5f15db88bf4281704b189a8940..0eeadee052a01a8a6f99abf76619c9f3a01ebf5b 100644 (file)
@@ -4908,7 +4908,9 @@ static bool test_lease_dynamic_share(struct torture_context *tctx,
        }
 
        /* Set sharename back. */
-       lpcfg_set_cmdline(tctx->lp_ctx, "torture:share", orig_share);
+       if (orig_share != NULL) {
+               lpcfg_set_cmdline(tctx->lp_ctx, "torture:share", orig_share);
+       }
 
        talloc_free(mem_ctx);