Skip to content

Commit 21a6491

Browse files
committed
CIFS: Clarify SMB1 code for POSIX Create
Coverity also complains about the way we calculate the offset (starting from the address of a 4 byte array within the header structure rather than from the beginning of the struct plus 4 bytes) for SMB1 CIFSPOSIXCreate. This changeset doesn't change the address but makes it slightly clearer. Addresses-Coverity: 711518 ("Out of bounds write") Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent b623661 commit 21a6491

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/cifs/cifssmb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,8 @@ CIFSPOSIXCreate(const unsigned int xid, struct cifs_tcon *tcon,
10811081
param_offset = offsetof(struct smb_com_transaction2_spi_req,
10821082
InformationLevel) - 4;
10831083
offset = param_offset + params;
1084-
pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset);
1084+
/* SMB offsets are from the beginning of SMB which is 4 bytes in, after RFC1001 field */
1085+
pdata = (OPEN_PSX_REQ *)((char *)(pSMB) + offset + 4);
10851086
pdata->Level = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC);
10861087
pdata->Permissions = cpu_to_le64(mode);
10871088
pdata->PosixOpenFlags = cpu_to_le32(posix_flags);

0 commit comments

Comments
 (0)