Skip to content

Commit eea8cac

Browse files
authored
Don't try to memcpy() to a NULL destination. (#637)
This function is called with a literal NULL for that pointer later in the file.
1 parent 86b056f commit eea8cac

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

mac/hid.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,9 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length)
11851185
return buffer (data), and delete the liked list item. */
11861186
struct input_report *rpt = dev->input_reports;
11871187
size_t len = (length < rpt->len)? length: rpt->len;
1188-
memcpy(data, rpt->data, len);
1188+
if (data != NULL) {
1189+
memcpy(data, rpt->data, len);
1190+
}
11891191
dev->input_reports = rpt->next;
11901192
free(rpt->data);
11911193
free(rpt);

0 commit comments

Comments
 (0)