[Patch] Prevent smbtree from aborting on Fedora Core 3
Jeremy Allison
jra at samba.org
Fri Oct 8 12:59:19 GMT 2004
On Wed, Sep 29, 2004 at 10:55:04AM -0400, 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;
> }
Thanks for that. I think Simo already fixed this in the SVN source.
Jeremy.
More information about the samba-technical
mailing list