From 6edb376d2948a8016a35bd3235f774b7387c2239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= Date: Fri, 7 Jan 2022 21:18:59 +0100 Subject: [PATCH] s3:smbd: Fix dereferencing null pointer "fsp" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG: https://bugzilla.samba.org/show_bug.cgi?id=14942 Remove fsp which is always NULL and replace it with smb_fname->fsp. Found by covscan. Signed-off-by: Pavel Filipenský Reviewed-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit 46460025175e83fbb47a510e412d83b1b2573db9) --- source3/smbd/dosmode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 027e04b1fa4..58fb0535c11 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -917,7 +917,6 @@ int file_set_dosmode(connection_struct *conn, mode_t tmp; mode_t unixmode; int ret = -1, lret = -1; - files_struct *fsp = NULL; NTSTATUS status; if (!CAN_WRITE(conn)) { @@ -1055,7 +1054,7 @@ int file_set_dosmode(connection_struct *conn, } become_root(); - ret = SMB_VFS_FCHMOD(fsp, unixmode); + ret = SMB_VFS_FCHMOD(smb_fname->fsp, unixmode); unbecome_root(); if (!newfile) { -- 2.30.2