From: kshumikhina Date: Thu, 11 Jun 2026 14:23:08 +0000 (+0400) Subject: s4:torture: Fix NULL pointer dereference in lpcfg_set_cmdline X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=796d366189d3a8e025348ca5bdf3c15cdfbdd65e;p=thirdparty%2Fsamba.git s4:torture: Fix NULL pointer dereference in lpcfg_set_cmdline 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 Signed-off-by: Shumikhina Ksenia Reviewed-by: Anoop C S Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Sat Jun 13 09:25:05 UTC 2026 on atb-devel-224 --- diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c index 481a0b83f39..0eeadee052a 100644 --- a/source4/torture/smb2/lease.c +++ b/source4/torture/smb2/lease.c @@ -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);