]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Fix dereference of NULL ctx when memory is not allocated
authorDaniil Sarafannikov <sarafannikovda@sgu.ru>
Thu, 25 Jun 2026 21:06:26 +0000 (01:06 +0400)
committerVolker Lendecke <vl@samba.org>
Tue, 30 Jun 2026 13:39:52 +0000 (13:39 +0000)
In case talloc_zero returns NULL, we must return NULL from
function check_ctx_create(). Otherwise, we dereference NULL
pointer when accessing fields of ctx struct.

Suggested-by: Anoop C S <anoopcs@samba.org>
Signed-off-by: Daniil Sarafannikov <sarafannikovda@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): Tue Jun 30 13:39:52 UTC 2026 on atb-devel-224

source3/utils/net_registry_check.c

index 52f4dab072295a63ef54e4708e3edce5e53541e6..aa5e65ecf81db1a576bd01afd593620c98349e56 100644 (file)
@@ -293,6 +293,9 @@ static struct check_ctx* check_ctx_create(TALLOC_CTX *mem_ctx, const char *db,
                                          const struct check_options *opt)
 {
        struct check_ctx *ctx = talloc_zero(mem_ctx, struct check_ctx);
+       if (ctx == NULL) {
+               return NULL;
+       }
 
        ctx->opt = *opt;
        ctx->reg = db_open_rbt(ctx);