Commit 76025cc2 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French
Browse files

smb: client: fix parsing of SMB3.1.1 POSIX create context



The data offset for the SMB3.1.1 POSIX create context will always be
8-byte aligned so having the check 'noff + nlen >= doff' in
smb2_parse_contexts() is wrong as it will lead to -EINVAL because noff
+ nlen == doff.

Fix the sanity check to correctly handle aligned create context data.

Fixes: af1689a9 ("smb: client: fix potential OOBs in smb2_parse_contexts()")
Signed-off-by: default avatarPaulo Alcantara <pc@manguebit.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent cfb7a133
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2277,7 +2277,7 @@ int smb2_parse_contexts(struct TCP_Server_Info *server,

		noff = le16_to_cpu(cc->NameOffset);
		nlen = le16_to_cpu(cc->NameLength);
		if (noff + nlen >= doff)
		if (noff + nlen > doff)
			return -EINVAL;

		name = (char *)cc + noff;