Skip to content

Commit

Permalink
drivers/tty/serial/8250: use strlcpy instead of strcpy
Browse files Browse the repository at this point in the history
  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>
  • Loading branch information
Chen Gang authored and Greg Kroah-Hartman committed Jan 20, 2013
1 parent 4f73bc4 commit f8a2b22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_early.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f8a2b22

Please sign in to comment.