mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 06:55:38 +00:00
hidapi: Avoid memcpy'ing to NULL.
(This fix was originally from @themightyoarfish on GitHub. Thanks!) Fixes #8428. Reference PR #8431. (cherry picked from commit c6d9fb1ad71462bc844c6ca41e2ac7fe7cec3883)
This commit is contained in:
parent
9d7feaaf9e
commit
065d80716b
|
@ -957,7 +957,9 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length)
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
if (rpt != NULL) {
|
if (rpt != NULL) {
|
||||||
len = (length < rpt->len)? length: rpt->len;
|
len = (length < rpt->len)? length: rpt->len;
|
||||||
memcpy(data, rpt->data, len);
|
if (data != NULL) {
|
||||||
|
memcpy(data, rpt->data, len);
|
||||||
|
}
|
||||||
dev->input_reports = rpt->next;
|
dev->input_reports = rpt->next;
|
||||||
free(rpt->data);
|
free(rpt->data);
|
||||||
free(rpt);
|
free(rpt);
|
||||||
|
|
Loading…
Reference in a new issue