DragonFlyBSD Kernel Audit
DF-1005 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/u4b/usb_device.c b/sys/bus/u4b/usb_device.c
--- a/sys/bus/u4b/usb_device.c
+++ b/sys/bus/u4b/usb_device.c
@@ -2270,8 +2270,10 @@
 		strcat(phys, tmp);
 		index++;
 	}
-	index = strlen(phys) - 1;
-	phys[index] = '\0';
+	if (strlen(phys) > 0) {
+		index = strlen(phys) - 1;
+		phys[index] = '\0';
+	}
 }
 
 /*------------------------------------------------------------------------*