Skip to content

Commit c270f85

Browse files
committed
Check CFGetTypeID for GetProperty on MacOS
1 parent b820bd2 commit c270f85

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/macos/device.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ impl Device {
5454
));
5555
}
5656

57+
if CFGetTypeID(prop_ref) != CFStringGetTypeID() {
58+
return Err(io::Error::new(
59+
io::ErrorKind::InvalidInput,
60+
format!(
61+
"IOHIDDeviceGetProperty returned non-string type for property {}",
62+
prop_name
63+
),
64+
));
65+
}
66+
5767
Ok(CFString::from_void(prop_ref).to_string())
5868
}
5969
}

0 commit comments

Comments
 (0)