s3:smbd: Fix dereferencing null pointer "fsp"
authorPavel Filipenský <pfilipen@redhat.com>
Fri, 7 Jan 2022 20:18:59 +0000 (21:18 +0100)
committerJule Anger <janger@samba.org>
Wed, 12 Jan 2022 14:27:00 +0000 (14:27 +0000)
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ý <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 46460025175e83fbb47a510e412d83b1b2573db9)

Autobuild-User(v4-15-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-15-test): Wed Jan 12 14:27:00 UTC 2022 on sn-devel-184

source3/smbd/dosmode.c

index 027e04b1fa40a70a6413a3010b9b4c1c71dee4c8..58fb0535c117b73b5e5e4c5b43bdb684a38b640d 100644 (file)
@@ -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) {