mirror of
https://github.com/troglobit/finit.git
synced 2026-11-17 19:30:29 +00:00
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:
1 parent
e44dfde54e
commit
289247dab9
1 file changed
+3
@@ -120,6 +120,9 @@ static int validate_ifname(const char *ifname)
|
|||||||
if (strlen(ifname) >= IFNAMSIZ)
|
if (strlen(ifname) >= IFNAMSIZ)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (strstr(ifname, ".."))
|
||||||
|
return 1;
|
||||||
|
|
||||||
while (*ifname) {
|
while (*ifname) {
|
||||||
if (*ifname == '/' || isspace(*ifname))
|
if (*ifname == '/' || isspace(*ifname))
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in new issue
Block a user