]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:loadparm: fix NULL pointer dereference in volume_label() master
authorJeremy Allison <jallison@ciq.com>
Fri, 10 Apr 2026 21:24:34 +0000 (14:24 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 15 Apr 2026 00:07:12 +0000 (00:07 +0000)
volume_label() calls lp_servicename() as a fallback when lp_volume()
returns an empty string. lp_servicename() is a FN_LOCAL_SUBSTITUTED_STRING
that falls back to sDefault.szService when the service is invalid. Since
sDefault.szService is initialized to NULL and is never set by
init_globals(), the substitution returns NULL, and the subsequent
strlen() call crashes with a segmentation fault.

Add a NULL guard so volume_label() returns an empty string instead
of crashing.

Remove knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14978

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 15 00:07:12 UTC 2026 on atb-devel-224

selftest/knownfail
source3/param/loadparm.c

index 40aaa28aed662a70a09fa3043718a7227d6c5a62..ab2d79d7114edb6ee29eafd4ef5e4ce84921471b 100644 (file)
 
 # We currently don't send referrals for LDAP modify of non-replicated attrs
 ^samba4.ldap.rodc.python\(rodc\).__main__.RodcTests.test_modify_nonreplicated.*
 
 # We currently don't send referrals for LDAP modify of non-replicated attrs
 ^samba4.ldap.rodc.python\(rodc\).__main__.RodcTests.test_modify_nonreplicated.*
-^samba3.blackbox.usershare_not_accessible.*(fileserver:local)
index e85b52fdc6d87be8d768ca3a1f8fbf14806309e7..dc0d8523172a7db502174caa85818ee37d4d0cfa 100644 (file)
@@ -4471,6 +4471,9 @@ const char *volume_label(TALLOC_CTX *ctx, int snum)
        if (!*label) {
                label = lp_servicename(ctx, lp_sub, snum);
        }
        if (!*label) {
                label = lp_servicename(ctx, lp_sub, snum);
        }
+       if (label == NULL) {
+               label = "";
+       }
 
        /*
         * Volume label can be a max of 32 bytes. Make sure to truncate
 
        /*
         * Volume label can be a max of 32 bytes. Make sure to truncate