]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
source3/passdb: Fix NULL dereference in _lsa_LookupSids()
authorAnoop C S <anoopcs@samba.org>
Tue, 19 May 2026 10:07:28 +0000 (15:37 +0530)
committerMartin Schwenke <martins@samba.org>
Thu, 21 May 2026 02:21:29 +0000 (02:21 +0000)
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 <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
source3/passdb/lookup_sid.c

index 7a29bb1abb5becf30dca26818e0abf94d9a76d37..61c67b7a809748ec3944d48b0418bc84777d0eb5 100644 (file)
@@ -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;
                }