mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-07 07:00:48 +00:00
hidapi: Avoid memcpy'ing to NULL.
(This fix was originally from @themightyoarfish on GitHub. Thanks!) Fixes #8428. Reference PR #8431.
This commit is contained in:
parent
4d1aecc225
commit
c6d9fb1ad7
1 changed files with 3 additions and 1 deletions
|
|
@ -1230,7 +1230,9 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length)
|
|||
return buffer (data), and delete the liked list item. */
|
||||
struct input_report *rpt = dev->input_reports;
|
||||
size_t 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;
|
||||
free(rpt->data);
|
||||
free(rpt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue