drivers/tty/serial/8250: use strlcpy instead of strcpy
authorChen Gang <gang.chen@asianux.com>
Sun, 20 Jan 2013 09:36:02 +0000 (17:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Jan 2013 23:50:36 +0000 (15:50 -0800)
  The fields must be null-terminated, or next printk for %s, will cause issue.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_early.c

index f53a7db4350d3dcb0666b8bf44bcc4f7617fe73f..721904f8efa92b8816665410822b355619679f47 100644 (file)
@@ -194,7 +194,7 @@ static int __init parse_options(struct early_serial8250_device *device,
                options++;
                device->baud = simple_strtoul(options, NULL, 0);
                length = min(strcspn(options, " "), sizeof(device->options));
-               strncpy(device->options, options, length);
+               strlcpy(device->options, options, length);
        } else {
                device->baud = probe_baud(port);
                snprintf(device->options, sizeof(device->options), "%u",