Fix: Explicit null dereferenced #547

Closed
opened 2023-05-13 15:39:18 -05:00 by Youw · 0 comments
Youw commented 2023-05-13 15:39:18 -05:00 (Migrated from github.com)

From Coverity: macos/hid.c:

hid_device * HID_API_EXPORT hid_open_path(const char *path)
1021{
    	1. assign_zero: Assigning: dev = NULL.
1022        hid_device *dev = NULL;
1023        io_registry_entry_t entry = MACH_PORT_NULL;
1024        IOReturn ret = kIOReturnInvalid;
1025        char str[32];
1026
1027        /* Set up the HID Manager if it hasn't been done */
    	2. Condition hid_init() < 0, taking true branch.
1028        if (hid_init() < 0) {
    	3. Jumping to label return_error.
1029                goto return_error;
1030        }

return_error:
    	
CID 1530048 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
4. var_deref_op: Dereferencing null pointer dev.
1088        if (dev->device_handle != NULL)
1089                CFRelease(dev->device_handle);
From Coverity: macos/hid.c: ```c hid_device * HID_API_EXPORT hid_open_path(const char *path) 1021{ 1. assign_zero: Assigning: dev = NULL. 1022 hid_device *dev = NULL; 1023 io_registry_entry_t entry = MACH_PORT_NULL; 1024 IOReturn ret = kIOReturnInvalid; 1025 char str[32]; 1026 1027 /* Set up the HID Manager if it hasn't been done */ 2. Condition hid_init() < 0, taking true branch. 1028 if (hid_init() < 0) { 3. Jumping to label return_error. 1029 goto return_error; 1030 } return_error: CID 1530048 (#1 of 1): Explicit null dereferenced (FORWARD_NULL) 4. var_deref_op: Dereferencing null pointer dev. 1088 if (dev->device_handle != NULL) 1089 CFRelease(dev->device_handle); ```
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi#547
No description provided.