aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2021-07-01 20:44:27 -0500
committerSteve French <stfrench@microsoft.com>2021-07-02 18:36:24 -0500
commitded2d99cef169a12a1d3961a540728675f525846 (patch)
tree5f9f436bc103fb953f0d9bdcce1393b09725f9c2 /fs/cifs
parentcifs: clarify SMB1 code for UnixCreateHardLink (diff)
downloadlinux-dev-ded2d99cef169a12a1d3961a540728675f525846.tar.xz
linux-dev-ded2d99cef169a12a1d3961a540728675f525846.zip
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>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifssmb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index ea12fa6eacb6..a14d3f533301 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2925,7 +2925,8 @@ createSymLinkRetry:
InformationLevel) - 4;
offset = param_offset + params;
- data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
+ /* SMB offsets are from the beginning of SMB which is 4 bytes in, after RFC1001 field */
+ data_offset = (char *)pSMB + offset + 4;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len_target =
cifsConvertToUTF16((__le16 *) data_offset, toName,