mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
smb: client: fix reparse buffer bounds in cifs_query_reparse_point()
In cifs_query_reparse_point(), the start >= end check before casting to
struct reparse_data_buffer * only ensures the start pointer is within the
response. It fails to verify that there is enough space remaining for the
fixed 8-byte header of the structure.
If a server provides a DataOffset that leaves less than 8 bytes remaining,
the check passes, but subsequent reads of ReparseTag and ReparseDataLength
will occur out-of-bounds.
Fix this by ensuring the remaining space is at least the size of the
reparse_data_buffer structure before accessing its fields.
Fixes: 56e84c64fc ("cifs: Fix validation of SMB1 query reparse point response")
Cc: stable@vger.kernel.org
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
This commit is contained in:
parent
4775c3b7a5
commit
5f0306e731
|
|
@ -3080,7 +3080,7 @@ int cifs_query_reparse_point(const unsigned int xid,
|
|||
|
||||
end = 2 + get_bcc(&io_rsp->hdr) + (__u8 *)&io_rsp->ByteCount;
|
||||
start = (__u8 *)&io_rsp->hdr.Protocol + data_offset;
|
||||
if (start >= end) {
|
||||
if (start >= end || (size_t)(end - start) < sizeof(*buf)) {
|
||||
rc = smb_EIO2(smb_eio_trace_qreparse_data_area,
|
||||
(unsigned long)start - (unsigned long)io_rsp,
|
||||
(unsigned long)end - (unsigned long)io_rsp);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user