]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: Fix dereferencing null pointer "fsp"
authorPavel Filipenský <pfilipen@redhat.com>
Fri, 7 Jan 2022 20:18:59 +0000 (21:18 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 10 Jan 2022 23:31:33 +0000 (23:31 +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>
source3/smbd/dosmode.c

index 9e4abf99c7773c9fd149f02b981505fef8590fc7..5b252d2bf64df6bca6eee9877c1ab32c54ab3f82 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) {