From: Vinit Agnihotri Date: Thu, 12 Jun 2025 10:30:26 +0000 (+0530) Subject: smbd: Fix coverity#1646864 Move variable init code in checked block X-Git-Tag: tevent-0.17.0~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9846179435945ee3022cbbd47fcbe1a8cd061a63;p=thirdparty%2Fsamba.git smbd: Fix coverity#1646864 Move variable init code in checked block 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 Reviewed-by: Anoop C S Reviewed-by: Noel Power Autobuild-User(master): Anoop C S Autobuild-Date(master): Thu Jun 12 16:49:02 UTC 2025 on atb-devel-224 --- diff --git a/source3/smbd/smb2_process.c b/source3/smbd/smb2_process.c index 829f6b4b11d..590c7f360d2 100644 --- a/source3/smbd/smb2_process.c +++ b/source3/smbd/smb2_process.c @@ -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) {