]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super-intel: fix buffer overflow in detail-platform.
authorNeilBrown <neilb@suse.de>
Wed, 13 Jul 2011 02:38:50 +0000 (12:38 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 13 Jul 2011 02:38:50 +0000 (12:38 +1000)
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>
super-intel.c

index 2ef2b3c6a77d3153fd45fc1d1c740ab4894aa7fc..5ea3b368cf28de197534dda955ac9219f08149cd 100644 (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);