super-intel: fix buffer overflow in detail-platform.

The serial number is not necessarily nul terminated, so we need to be
sure to only use the allowed number of chars.

Signed-off-by: NeilBrown <neilb@suse.de>
Reported-by: Arvin Schnell <aschnell@novell.com>
This commit is contained in:
NeilBrown 2011-07-13 12:38:50 +10:00
parent 1e49aaa069
commit 664d53258d
1 changed files with 2 additions and 2 deletions

View File

@ -1518,9 +1518,9 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
fd2devname(fd, buf);
printf(" Port%d : %s", port, buf);
if (imsm_read_serial(fd, NULL, (__u8 *) buf) == 0)
printf(" (%s)\n", buf);
printf(" (%.*s)\n", MAX_RAID_SERIAL_LEN, buf);
else
printf("()\n");
printf(" ()\n");
}
close(fd);
free(path);