drivers/tty/serial/8250: use strlcpy instead of strcpy

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>
This commit is contained in:
Chen Gang 2013-01-20 17:36:02 +08:00 коммит произвёл Greg Kroah-Hartman
Родитель 4f73bc4dd3
Коммит f8a2b220af
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

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