librc: do not allow "." and ".." as runlevel names
The rc_runlevel_exists function was attempting to treat "." and ".." as valid runlevels; however, this should not be allowed. X-Gentoo-Bug: 488710 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=488710
This commit is contained in:
parent
48981be8a8
commit
aeb670f4e8
@ -425,7 +425,7 @@ rc_runlevel_exists(const char *runlevel)
|
||||
char path[PATH_MAX];
|
||||
struct stat buf;
|
||||
|
||||
if (!runlevel)
|
||||
if (!runlevel || strcmp(runlevel, ".") == 0 || strcmp(runlevel, "..") == 0)
|
||||
return false;
|
||||
snprintf(path, sizeof(path), "%s/%s", RC_RUNLEVELDIR, runlevel);
|
||||
if (stat(path, &buf) == 0 && S_ISDIR(buf.st_mode))
|
||||
|
Loading…
Reference in New Issue
Block a user