]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Fix possible dereference of NULL ctx
authorDaniil Sarafannikov <sarafannikovda@sgu.ru>
Tue, 23 Jun 2026 17:03:03 +0000 (21:03 +0400)
committerVolker Lendecke <vl@samba.org>
Tue, 30 Jun 2026 12:35:36 +0000 (12:35 +0000)
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 <tascad@altlinux.org>
Signed-off-by: Daniil Sarafannikov <sarafannikovda@sgu.ru>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/utils/net_registry_check.c

index 6cb92565138e324b916f2c604c1a2fae8ad5b725..52f4dab072295a63ef54e4708e3edce5e53541e6 100644 (file)
@@ -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);