[PATCH] hid: Validate pointer passed into GetCaps

Rémi Bernon rbernon at codeweavers.com
Tue Aug 10 04:20:36 CDT 2021


On 8/10/21 8:35 AM, Alistair Leslie-Hughes wrote:
> 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;
> 

I had some tests for this at some point, Windows 10 does the validation 
but Windows 7 doesn't. I guess it's alright to do it, and I've sent an 
updated patch.
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list