[IA64] Fix a possible buffer overflow in efi.c
authorZou Nan hai <nanhai.zou@intel.com>
Tue, 7 Feb 2006 03:25:55 +0000 (11:25 +0800)
committerTony Luck <tony.luck@intel.com>
Tue, 7 Feb 2006 18:59:37 +0000 (10:59 -0800)
Make sure to save space for the trailing '\0'.

Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/kernel/efi.c

index c485a3b32ba8ba4a31ce380635441ab4e3ff1729..d51c2f214875ebecc4ebda328b77f3b8047ffc17 100644 (file)
@@ -458,7 +458,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';
        }