We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4968

Summary: NULL passed to memcpy in WriteProprietary in SDL_hidapi_switch.c
Product: SDL Reporter: Mathieu Eyraud <meyraud705>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.10   
Hardware: All   
OS: All   
Attachments: check for NULL

Description Mathieu Eyraud 2020-02-06 12:38:47 UTC
Created attachment 4193 [details]
check for NULL

In SDL_hidapi_switch.c

line 443: Function BTrySetupUSB call WriteProprietary with pBuf=NULL and ucLen=0
line 376: WriteProprietary check its input (!pBuf && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData): ucLen is 0 so it passes
line 382: WriteProprietary call memcpy with pBuf=NULL
Comment 1 Sam Lantinga 2020-02-07 19:50:50 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/9ebdd8dfc588