Skip to content

Commit 7b09d4e

Browse files
committed
CIFS: Clarify SMB1 code for POSIX delete file
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 CIFSPOSIXDelFile. This changeset doesn't change the address but makes it slightly clearer. Addresses-Coverity: 711519 ("Out of bounds write") Signed-off-by: Steve French <[email protected]>
1 parent 21a6491 commit 7b09d4e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/cifs/cifssmb.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,11 @@ CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon,
873873
InformationLevel) - 4;
874874
offset = param_offset + params;
875875

876-
/* Setup pointer to Request Data (inode type) */
877-
pRqD = (struct unlink_psx_rq *)(((char *)&pSMB->hdr.Protocol) + offset);
876+
/* Setup pointer to Request Data (inode type).
877+
* Note that SMB offsets are from the beginning of SMB which is 4 bytes
878+
* in, after RFC1001 field
879+
*/
880+
pRqD = (struct unlink_psx_rq *)((char *)(pSMB) + offset + 4);
878881
pRqD->type = cpu_to_le16(type);
879882
pSMB->ParameterOffset = cpu_to_le16(param_offset);
880883
pSMB->DataOffset = cpu_to_le16(offset);

0 commit comments

Comments
 (0)