From dec362a766fbf5d6774dd699b6044841e042f8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 10 Jun 2021 10:06:24 +0200 Subject: [PATCH] hid: Check preparsed data magic in HidP_GetLinkCollectionNodes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/hid/hidp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index a7003717a21..2933c2ff7ef 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -1001,6 +1001,9 @@ NTSTATUS WINAPI HidP_GetLinkCollectionNodes(HIDP_LINK_COLLECTION_NODE *LinkColle TRACE("(%p, %p, %p)\n", LinkCollectionNode, LinkCollectionNodeLength, PreparsedData); + if (data->magic != HID_MAGIC) + return HIDP_STATUS_INVALID_PREPARSED_DATA; + if (*LinkCollectionNodeLength < data->caps.NumberLinkCollectionNodes) return HIDP_STATUS_BUFFER_TOO_SMALL;