]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Fix coverity#1646864 Move variable init code in checked block
authorVinit Agnihotri <vagnihot@redhat.com>
Thu, 12 Jun 2025 10:30:26 +0000 (16:00 +0530)
committerAnoop C S <anoopcs@samba.org>
Thu, 12 Jun 2025 16:49:02 +0000 (16:49 +0000)
xconn was getting dereference outside NULL check block, causing
'Dereference after null check' issue.

Fix moves offeding initialisation in NULL check blog.

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Jun 12 16:49:02 UTC 2025 on atb-devel-224

source3/smbd/smb2_process.c

index 829f6b4b11d544460743fcef8df1af129cdaf2ed..590c7f360d25f1748390e85d0199eb3485c9a398 100644 (file)
@@ -771,12 +771,12 @@ bool init_smb1_request(struct smb_request *req,
                if (NT_STATUS_IS_OK(status)) {
                        req->conn = tcon->compat;
                }
-       }
 
 #if defined(WITH_SMB1SERVER)
-       req->posix_pathnames = (xconn->smb1.unix_info.client_cap_low &
-                               CIFS_UNIX_POSIX_PATHNAMES_CAP) != 0;
+               req->posix_pathnames = (xconn->smb1.unix_info.client_cap_low &
+                                       CIFS_UNIX_POSIX_PATHNAMES_CAP) != 0;
 #endif
+       }
 
        /* Ensure we have at least wct words and 2 bytes of bcc. */
        if (smb_size + req->wct*2 > req_size) {