Skip to content

Commit ded2d99

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

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
@@ -2925,7 +2925,8 @@ CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
29252925
InformationLevel) - 4;
29262926
offset = param_offset + params;
29272927

2928-
data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
2928+
/* SMB offsets are from the beginning of SMB which is 4 bytes in, after RFC1001 field */
2929+
data_offset = (char *)pSMB + offset + 4;
29292930
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
29302931
name_len_target =
29312932
cifsConvertToUTF16((__le16 *) data_offset, toName,

0 commit comments

Comments
 (0)