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 - NULL passed to memcpy in WriteProprietary in SDL_hidapi_switch.c
Summary: NULL passed to memcpy in WriteProprietary in SDL_hidapi_switch.c
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.10
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-06 12:38 UTC by Mathieu Eyraud
Modified: 2020-02-07 19:50 UTC (History)
0 users

See Also:


Attachments
check for NULL (595 bytes, patch)
2020-02-06 12:38 UTC, Mathieu Eyraud
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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