Skip to contentSkip to conversation

isdn: icn: use strlcpy() when parsing setup options

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 15, 2015 – Mar 16, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 isdn: icn: use strlcpy() when parsing setup options

If you pass an invalid string here then you probably deserve the memory corruption, but it annoys static analysis tools so lets fix it.

drivers/isdn/icn/icn.c +1 -1
index 6a7447c..358a574 100644
@@ -1609,7 +1609,7 @@ icn_setup(char *line)
 	if (ints[0] > 1)
 		membase = (unsigned long)ints[2];
 	if (str && *str) {
-		strcpy(sid, str);
+		strlcpy(sid, str, sizeof(sid));
 		icn_id = sid;
 		if ((p = strchr(sid, ','))) {
 			*p++ = 0;