Commit 32bc746178fae213f84fae8311ebca3513af0e9d

Con Kolivas 2013-10-09T22:17:56

Check for presence of driver name in DRIVER_COUNT_FOUND to prevent strcmp on a null pointer when a driver is not built in.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/usbutils.c b/usbutils.c
index 01e69dc..137c2e5 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -3140,7 +3140,7 @@ void usb_cleanup()
 	cgsem_destroy(&usb_resource_sem);
 }
 
-#define DRIVER_COUNT_FOUND(X) if (strcasecmp(ptr, X##_drv.name) == 0) { \
+#define DRIVER_COUNT_FOUND(X) if (X##_drv.name && strcasecmp(ptr, X##_drv.name) == 0) { \
 	drv_count[X##_drv.drv_id].limit = lim; \
 	found = true; \
 	}