]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:lib: Fix CID 1497484 use-after-free.
authorVinit Agnihotri <vagnihot@redhat.com>
Tue, 29 Jul 2025 05:02:06 +0000 (10:32 +0530)
committerGünther Deschner <gd@samba.org>
Tue, 29 Jul 2025 15:01:42 +0000 (15:01 +0000)
p was not set to NULL after being free'd, this can cause a
use-after-free situation.

This fixes coverity issue#1497484

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Jul 29 15:01:42 UTC 2025 on atb-devel-224

source3/lib/netapi/examples/common.c

index 72d7150b4eaee7a90cedcc2cc3343f90777ac030..3e5664424ef964c0009f79a2eab1357522d1b93a 100644 (file)
@@ -156,6 +156,7 @@ char *netapi_read_file(const char *filename, uint32_t *psize)
        err = ferror(file);
        if (err != 0) {
                free(p);
+               p = NULL;
                goto fail;
        }