[PATCH 2/2] param: avoid dereferencing null lp_ctx
Michael Adam
obnox at samba.org
Mon Aug 11 10:03:43 MDT 2014
Good catch, thanks!
Reviewed-by: me
Michael
On 2014-08-11 at 17:57 +0200, David Disseldorp wrote:
> 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 at samba.org>
> ---
> source3/param/loadparm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
> index c428c23..94d3b8d 100644
> --- a/source3/param/loadparm.c
> +++ b/source3/param/loadparm.c
> @@ -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) {
> --
> 1.8.4.5
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140811/0956d165/attachment.pgp>
More information about the samba-technical
mailing list