Commit a9d48205 authored by Eric Dumazet's avatar Eric Dumazet Committed by 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: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment