浏览代码

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Dan Carpenter 10 年之前
父节点
当前提交
10640d3455
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/isdn/icn/icn.c

+ 1 - 1
drivers/isdn/icn/icn.c

@@ -1609,7 +1609,7 @@ icn_setup(char *line)
 	if (ints[0] > 1)
 	if (ints[0] > 1)
 		membase = (unsigned long)ints[2];
 		membase = (unsigned long)ints[2];
 	if (str && *str) {
 	if (str && *str) {
-		strcpy(sid, str);
+		strlcpy(sid, str, sizeof(sid));
 		icn_id = sid;
 		icn_id = sid;
 		if ((p = strchr(sid, ','))) {
 		if ((p = strchr(sid, ','))) {
 			*p++ = 0;
 			*p++ = 0;