param: avoid dereferencing null lp_ctx
authorDavid Disseldorp <ddiss@samba.org>
Mon, 11 Aug 2014 15:51:58 +0000 (17:51 +0200)
committerDavid Disseldorp <ddiss@samba.org>
Mon, 11 Aug 2014 19:00:15 +0000 (21:00 +0200)
process_smbconf_service() calls lp_do_section() with a NULL userdata
(struct loadparm_context *) argument. Since 0864d4945, lp_do_section()
unconditionally attempts to set the lp_ctx->bInGlobalSection variable,
resulting in a segfault.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Aug 11 21:00:15 CEST 2014 on sn-devel-104

source3/param/loadparm.c

index c428c236017ea75f9eebeac23646a56a5cd5e2a8..94d3b8de574e4ec9b8f9179dc17ecca8010566c8 100644 (file)
@@ -2584,7 +2584,9 @@ bool lp_do_section(const char *pszSectionName, void *userdata)
 
        /* if we've just struck a global section, note the fact. */
        bInGlobalSection = isglobal;
-       lp_ctx->bInGlobalSection = isglobal;
+       if (lp_ctx != NULL) {
+               lp_ctx->bInGlobalSection = isglobal;
+       }
 
        /* check for multiple global sections */
        if (bInGlobalSection) {