[PATCH] hid: Validate pointer passed into GetCaps

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Aug 10 01:35:24 CDT 2021


Power Rangers: Battle for the Grid.

0514:trace:hidp:HidP_GetCaps preparsed_data 000000004C9566B0, caps 000000000010EF00.
0514:trace:hidp:HidP_GetCaps preparsed_data 0000000000000000, caps 000000000010F020.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/hid/hidp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
index 6259e0f56a9..c3a99f0b9d5 100644
--- a/dlls/hid/hidp.c
+++ b/dlls/hid/hidp.c
@@ -167,7 +167,7 @@ NTSTATUS WINAPI HidP_GetCaps( PHIDP_PREPARSED_DATA preparsed_data, HIDP_CAPS *ca
 
     TRACE( "preparsed_data %p, caps %p.\n", preparsed_data, caps );
 
-    if (preparsed->magic != HID_MAGIC) return HIDP_STATUS_INVALID_PREPARSED_DATA;
+    if (!preparsed || preparsed->magic != HID_MAGIC) return HIDP_STATUS_INVALID_PREPARSED_DATA;
 
     *caps = preparsed->caps;
     return HIDP_STATUS_SUCCESS;
-- 
2.30.2




More information about the wine-devel mailing list