Skip to contentSkip to conversation

Fix a possible buffer overflow in efi.c

PATCH New Zou Nan hai 1 participant 1 message Feb 7, 2006 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix a possible buffer overflow in efi.c

There is a possible buffer overflow in efi.c
At lease the code logic is wrong.

arch/ia64/kernel/efi.c +1 -1
diff -Nraup linux-2.6.15/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
@@ -432,7 +432,7 @@ efi_init (void)
 	/* Show what we know for posterity */
 	c16 = __va(efi.systab->fw_vendor);
 	if (c16) {
-		for (i = 0;i < (int) sizeof(vendor) && *c16; ++i)
+		for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i)
 			vendor[i] = *c16++;
 		vendor[i] = '\0';
 	}