cifs: fix negotiate context parsing
authorDavid Disseldorp <ddiss@suse.de>
Thu, 6 Apr 2023 22:34:11 +0000 (00:34 +0200)
committerSteve French <stfrench@microsoft.com>
Sat, 15 Apr 2023 23:26:56 +0000 (18:26 -0500)
commit5105a7ffce19160e7062aee67fb6b3b8a1b56d78
treeee227deca4072e030d02e42c3722530098e0d18e
parent09a9639e56c01c7a00d6c0ca63f4c7c41abe075d
cifs: fix negotiate context parsing

smb311_decode_neg_context() doesn't properly check against SMB packet
boundaries prior to accessing individual negotiate context entries. This
is due to the length check omitting the eight byte smb2_neg_context
header, as well as incorrect decrementing of len_of_ctxts.

Fixes: 5100d8a3fe03 ("SMB311: Improve checking of negotiate security contexts")
Reported-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2pdu.c