Skip to contentSkip to conversation

x86: Buffer overflow

PATCH New Roel Kluin 1 participant 1 message Jul 28, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 x86: Buffer overflow

If the vendor name (from c16) can be longer than 100 bytes (or missing a terminating null), then the null is writen past the end of vendor[].

---
Found with Parfait, http://research.sun.com/projects/parfait/

arch/x86/kernel/efi.c +1 -1
index 96f7ac0..436a42f 100644
@@ -354,7 +354,7 @@ void __init efi_init(void)
 	 */
 	c16 = tmp = early_ioremap(efi.systab->fw_vendor, 2);
 	if (c16) {
-		for (i = 0; i < sizeof(vendor) && *c16; ++i)
+		for (i = 0; i < sizeof(vendor) - 1 && *c16; ++i)
 			vendor[i] = *c16++;
 		vendor[i] = '\0';
 	} else