提交 a9d48205 编写于 作者: E Eric Dumazet 提交者: David S. Miller

net: fool proof dev_valid_name()

We want to use dev_valid_name() to validate tunnel names,
so better use strnlen(name, IFNAMSIZ) than strlen(name) to make
sure to not upset KASAN.
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 06dd3dfe
...@@ -1027,7 +1027,7 @@ bool dev_valid_name(const char *name) ...@@ -1027,7 +1027,7 @@ bool dev_valid_name(const char *name)
{ {
if (*name == '\0') if (*name == '\0')
return false; return false;
if (strlen(name) >= IFNAMSIZ) if (strnlen(name, IFNAMSIZ) == IFNAMSIZ)
return false; return false;
if (!strcmp(name, ".") || !strcmp(name, "..")) if (!strcmp(name, ".") || !strcmp(name, ".."))
return false; return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册