Skip to content

Commit

Permalink
hidraw: fixed crash if uevent info isn't available (#580)
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
  • Loading branch information
slouken authored May 31, 2023
1 parent b8ab253 commit a88805e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions linux/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,11 @@ static int parse_uevent_info(const char *uevent, unsigned *bus_type,
char **serial_number_utf8, char **product_name_utf8)
{
char tmp[1024];

if (!uevent) {
return 0;
}

size_t uevent_len = strlen(uevent);
if (uevent_len > sizeof(tmp) - 1)
uevent_len = sizeof(tmp) - 1;
Expand Down

0 comments on commit a88805e

Please sign in to comment.