platform: relax assert when checking pathnames for accessing sysctl
Asserting against "/.." is wrong, because one could rename a link to "..em1", which is a valid ifname but would crash NetworkManager. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
@@ -1602,7 +1602,7 @@ sysctl_set (NMPlatform *platform, const char *path, const char *value)
|
||||
g_assert (g_str_has_prefix (path, "/proc/sys/")
|
||||
|| g_str_has_prefix (path, "/sys/"));
|
||||
/* Don't write to suspicious locations */
|
||||
g_assert (!strstr (path, "/.."));
|
||||
g_assert (!strstr (path, "/../"));
|
||||
|
||||
fd = open (path, O_WRONLY | O_TRUNC);
|
||||
if (fd == -1) {
|
||||
@@ -1701,7 +1701,7 @@ sysctl_get (NMPlatform *platform, const char *path)
|
||||
g_assert (g_str_has_prefix (path, "/proc/sys/")
|
||||
|| g_str_has_prefix (path, "/sys/"));
|
||||
/* Don't write to suspicious locations */
|
||||
g_assert (!strstr (path, "/.."));
|
||||
g_assert (!strstr (path, "/../"));
|
||||
|
||||
if (!g_file_get_contents (path, &contents, NULL, &error)) {
|
||||
/* We assume FAILED means EOPNOTSUP */
|
||||
|
Reference in New Issue
Block a user