netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] isdn: icn: use strlcpy() when parsing setup options
@ 2015-03-15 10:48 Dan Carpenter
  2015-03-16  2:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-03-15 10:48 UTC (permalink / raw)
  To: Karsten Keil; +Cc: David S. Miller, netdev, kernel-janitors

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6a7447c..358a574 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] isdn: icn: use strlcpy() when parsing setup options
  2015-03-15 10:48 [patch] isdn: icn: use strlcpy() when parsing setup options Dan Carpenter
@ 2015-03-16  2:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-03-16  2:26 UTC (permalink / raw)
  To: dan.carpenter; +Cc: isdn, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Sun, 15 Mar 2015 13:48:03 +0300

> If you pass an invalid string here then you probably deserve the memory
> corruption, but it annoys static analysis tools so lets fix it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks Dan.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-16  2:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-15 10:48 [patch] isdn: icn: use strlcpy() when parsing setup options Dan Carpenter
2015-03-16  2:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).