From: Daniil Sarafannikov Date: Tue, 23 Jun 2026 17:03:03 +0000 (+0400) Subject: s3:utils: Fix possible dereference of NULL ctx X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d0758634078d36f4aff36d5f4ff9edfba350968;p=thirdparty%2Fsamba.git s3:utils: Fix possible dereference of NULL ctx In case check_ctx_create in net_registry_check_db() returns NULL, the pointer ctx is NULL and execution jumps to 'done' label, where function check_ctx_transaction_stop is called. In this fuction the ctx pointer is dereferenced instantly, so the NULL pointer will be dereferenced. In case check_ctx_create returns NULL, we can just return -1 from net_registry_check_db. Pair-Programmed-With: Dmitry Mikhalchenko Signed-off-by: Daniil Sarafannikov Reviewed-by: Anoop C S Reviewed-by: Volker Lendecke --- diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c index 6cb92565138..52f4dab0722 100644 --- a/source3/utils/net_registry_check.c +++ b/source3/utils/net_registry_check.c @@ -1263,8 +1263,8 @@ int net_registry_check_db(const char *name, const struct check_options *opt) NTSTATUS status; int ret = -1; struct check_ctx *ctx = check_ctx_create(talloc_tos(), name, opt); - if (ctx==NULL) { - goto done; + if (ctx == NULL) { + return ret; } d_printf("Check database: %s\n", name);