From 8327e5304e6fb961ab59e3d2e2833184a8d9addd Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Wed, 13 Sep 2017 16:23:53 -0700 Subject: [PATCH] vfs_streams_xattr: Fix segfault when running with log level 10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This happens when vfs_streams_xattr is loaded, log level is set to 10 and the default stream of a file or directory is accessed. In that case streams_xattr_open does not allocate the stream_io fsp extension. The DBG_DEBUG message in streams_xattr_fstat tries to access the stream_io before checking for a NULL value, resulting in the crash. Fix this by moving the debug message after the check for a NULL pointer. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13032 Signed-off-by: Christof Schmitt Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu Sep 14 10:58:12 CEST 2017 on sn-devel-144 --- source3/modules/vfs_streams_xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 4cf4579..eff9264 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -232,12 +232,12 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, struct stream_io *io = (struct stream_io *) VFS_FETCH_FSP_EXTENSION(handle, fsp); - DBG_DEBUG("streams_xattr_fstat called for %s\n", fsp_str_dbg(io->fsp)); - if (io == NULL || fsp->base_fsp == NULL) { return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); } + DBG_DEBUG("streams_xattr_fstat called for %s\n", fsp_str_dbg(io->fsp)); + if (!streams_xattr_recheck(io)) { return -1; } -- 1.8.3.1