From e6834a153592ff998a7560ebb0fc5dfe50b3db7b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 25 May 2023 17:13:41 -0700
Subject: [PATCH] hidapi/linux: fixed crash if uevent info isn't available
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
---
src/hidapi/linux/hid.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/hidapi/linux/hid.c b/src/hidapi/linux/hid.c
index e742b13aa6f2..265f42474a2e 100644
--- a/src/hidapi/linux/hid.c
+++ b/src/hidapi/linux/hid.c
@@ -513,6 +513,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;