Skip to contentSkip to conversation

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

PATCH New Chen Gang 1 participant 1 message Jan 20, 2013 TTY layer and serial drivers

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

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

The fields must be null-terminated, or next printk for %s, will cause issue.

---
 drivers/tty/serial/8250/8250_early.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_early.c +1 -1
index f53a7db..721904f 100644
@@ -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",
Signature · 1 line
1.7.10.4