[Patch] Prevent smbtree from aborting on Fedora Core 3

Simo Sorce idra at samba.org
Wed Sep 29 15:22:27 GMT 2004


I've already applied a similar patch to the svn tree a few days ago :-)

Thanks.
Simo.

On Wed, 2004-09-29 at 16:55, Jay Fenlason wrote:
> The attached patch to the x_fclose function makes smbtree stop
> aborting on startup on Fedora Core 3 (or other systems that use a
> recent glibc).
> 
> I'm not convinced that this is the correct fix (I think it's rather
> suspicious that smbtree sets the log file to stderr and promptly
> closes it.)
> 
> The failure mode is that if x_fclose is called on x_stdin, x_stdout
> or x_stderr, SAFE_FREE gets called with the address of a constant
> structure.  Newer glibc detects free being called with a wild pointer
> and aborts.
> 
> 			-- JF
> 
> 
> --- samba-3.0.8pre1/source/lib/#xfile.c~	2004-09-28 17:01:29.000000000 -0400
> +++ samba-3.0.8pre1/source/lib/xfile.c	2004-09-28 17:01:29.000000000 -0400
> @@ -135,7 +135,9 @@
>  		memset(f->buf, 0, f->bufsize);
>  		SAFE_FREE(f->buf);
>  	}
> -	SAFE_FREE(f);
> +	if ( f != &_x_stdin && f != &_x_stdout && f != &_x_stderr ) {
> +	    SAFE_FREE(f);
> +	}
>  	return ret;
>  }
>  
-- 
Simo Sorce    -  idra at samba.org
Samba Team    -  http://www.samba.org
Italian Site  -  http://samba.xsec.it



More information about the samba-technical mailing list