⬢ DragonFlyBSD Kernel Audit
DF-2328 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/ppbus/ppbconf.c
+++ b/sys/bus/ppbus/ppbconf.c
@@ -219,6 +219,14 @@
 	char str[PPB_PnP_STRING_SIZE+1];
 	int unit = device_get_unit(bus);
 
+	/*
+	 * DF-2328: ppb_1284_read_id clears only PPB_PnP_STRING_SIZE (256)
+	 * bytes of this 257-byte stack object; a 256-byte NUL-free device
+	 * ID leaves str[256] uninitialized and the UNKNOWN_LENGTH scans
+	 * below can walk past the object.  Terminate it explicitly.
+	 */
+	str[PPB_PnP_STRING_SIZE] = '\0';
+
 	kprintf("Probing for PnP devices on ppbus%d:\n", unit);
 	
 	if ((error = ppb_1284_read_id(bus, PPB_NIBBLE, str,