mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-31 22:42:52 +08:00
hidapi/linux: fixed crash if uevent info isn't available
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
This commit is contained in:
@@ -513,6 +513,11 @@ static int parse_uevent_info(const char *uevent, unsigned *bus_type,
|
|||||||
char **serial_number_utf8, char **product_name_utf8)
|
char **serial_number_utf8, char **product_name_utf8)
|
||||||
{
|
{
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
|
|
||||||
|
if (!uevent) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
size_t uevent_len = strlen(uevent);
|
size_t uevent_len = strlen(uevent);
|
||||||
if (uevent_len > sizeof(tmp) - 1)
|
if (uevent_len > sizeof(tmp) - 1)
|
||||||
uevent_len = sizeof(tmp) - 1;
|
uevent_len = sizeof(tmp) - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user