From 09b652b70a448e2350c7d575f9091865d53b94ec Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 9 Mar 2022 13:54:23 -0800 Subject: [PATCH] Make sure the string properties are actually strings (thanks Nat!) --- src/hidapi/mac/hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hidapi/mac/hid.c b/src/hidapi/mac/hid.c index 716c7debb..a9a85b1f7 100644 --- a/src/hidapi/mac/hid.c +++ b/src/hidapi/mac/hid.c @@ -259,7 +259,7 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t buf[0] = 0; - if (str) { + if (str && CFGetTypeID(str) == CFStringGetTypeID()) { len --; CFIndex str_len = CFStringGetLength(str); @@ -298,7 +298,7 @@ static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, cha buf[0] = 0; - if (str) { + if (str && CFGetTypeID(str) == CFStringGetTypeID()) { len--; CFIndex str_len = CFStringGetLength(str);