From 3ed0a51423e9bf02fc1877904ac1abdbe552aade Mon Sep 17 00:00:00 2001
From: Stefano Ceccherini <stefano.ceccherini@gmail.com>
Date: Sat, 9 Nov 2013 21:32:35 +0100
Subject: [PATCH] Check the given path for ".."
---
.../kernel/network/devices/ethernet/ethernet.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/add-ons/kernel/network/devices/ethernet/ethernet.cpp b/src/add-ons/kernel/network/devices/ethernet/ethernet.cpp
index d989075..0e5941a 100644
a
|
b
|
ethernet_link_checker(void *)
|
118 | 118 | status_t |
119 | 119 | ethernet_init(const char *name, net_device **_device) |
120 | 120 | { |
121 | | // make sure this is a device in /dev/net, but not the |
122 | | // networking (userland) stack driver |
| 121 | // Make sure this is a device in /dev/net, but not the |
| 122 | // networking (userland) stack driver. |
| 123 | // Also make sure the user didn't pass a path like |
| 124 | // /dev/net/../etc. |
123 | 125 | if (strncmp(name, "/dev/net/", 9) |
124 | | || !strcmp(name, "/dev/net/userland_server")) |
| 126 | || !strcmp(name, "/dev/net/userland_server") |
| 127 | || strstr(name, "..") != NULL) |
125 | 128 | return B_BAD_VALUE; |
126 | 129 | |
127 | 130 | if (access(name, F_OK) != 0) |