plugins: netlink: slightly stricter ifname validation

Check if ifname contains double periods, this should *not* be a valid
name, though eth0.10 is, et0..10 is not.  Should protect better against
directory traversal attacks.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-03-07 13:25:40 +01:00
1 parent e44dfde54e
commit 289247dab9
1 file changed
+3
+3
View File
@@ -120,6 +120,9 @@ static int validate_ifname(const char *ifname)
if (strlen(ifname) >= IFNAMSIZ)
return 1;
if (strstr(ifname, ".."))
return 1;
while (*ifname) {
if (*ifname == '/' || isspace(*ifname))
return 1;