Commit ecdd5dab authored by Zou Nan hai's avatar Zou Nan hai Committed by Tony Luck

[IA64] Fix a possible buffer overflow in efi.c

Make sure to save space for the trailing '\0'.
Signed-off-by: default avatarZou Nan hai <nanhai.zou@intel.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent d43da75f
...@@ -458,7 +458,7 @@ efi_init (void) ...@@ -458,7 +458,7 @@ efi_init (void)
/* Show what we know for posterity */ /* Show what we know for posterity */
c16 = __va(efi.systab->fw_vendor); c16 = __va(efi.systab->fw_vendor);
if (c16) { 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] = *c16++;
vendor[i] = '\0'; vendor[i] = '\0';
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment