mac-capture: Fix potential crash querying devices
I didn't check to see if the size of the string was 0, when it's 0 it won't create the converted string and it'll send a null pointer to CFStringGetCString, causing it to crash.
This commit is contained in:
parent
b120f7cc80
commit
6b8b5e5f64
@ -24,6 +24,9 @@ static inline bool cf_to_dstr(CFStringRef ref, struct dstr *str)
|
||||
if (!ref) return false;
|
||||
|
||||
size = (size_t)CFStringGetLength(ref);
|
||||
if (!size)
|
||||
return false;
|
||||
|
||||
dstr_resize(str, size);
|
||||
|
||||
return (bool)CFStringGetCString(ref, str->array, size+1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user