From: Anoop C S Date: Tue, 19 May 2026 10:07:28 +0000 (+0530) Subject: source3/passdb: Fix NULL dereference in _lsa_LookupSids() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2df088dcf022172584ec5dff2c9195ec9b4c27e0;p=thirdparty%2Fsamba.git source3/passdb: Fix NULL dereference in _lsa_LookupSids() When lookup_sids() returns NT_STATUS_NONE_MAPPED but exits early without populating the names array, the subsequent dereference of names causes a NULL pointer dereference. Return an appropriate error status that allows existing error handling to catch this case before the NULL dereference occurs. Signed-off-by: Anoop C S Reviewed-by: Martin Schwenke --- diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index 7a29bb1abb5..61c67b7a809 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -1073,7 +1073,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids, if (j == LSA_REF_DOMAIN_LIST_MULTIPLIER) { /* TODO: What's the right error message here? */ - result = NT_STATUS_NONE_MAPPED; + result = NT_STATUS_TOO_MANY_CONTEXT_IDS; goto fail; }