Skip to content

Commit b019e11

Browse files
committed
CIFS: Clarify SMB1 code for UnixSetPathInfo
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 doing SetPathInfo (setattr) when using the Unix extensions. This doesn't change the address but makes it slightly clearer. Addresses-Coverity: 711528 ("Out of bounds read") Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent ded2d99 commit b019e11

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

fs/cifs/cifssmb.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6064,9 +6064,8 @@ CIFSSMBUnixSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
60646064
param_offset = offsetof(struct smb_com_transaction2_spi_req,
60656065
InformationLevel) - 4;
60666066
offset = param_offset + params;
6067-
data_offset =
6068-
(FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol +
6069-
offset);
6067+
/* SMB offsets are from the beginning of SMB which is 4 bytes in, after RFC1001 field */
6068+
data_offset = (FILE_UNIX_BASIC_INFO *)((char *) pSMB + offset + 4);
60706069
memset(data_offset, 0, count);
60716070
pSMB->DataOffset = cpu_to_le16(offset);
60726071
pSMB->ParameterOffset = cpu_to_le16(param_offset);

0 commit comments

Comments
 (0)