summaryrefslogtreecommitdiff
path: root/src/librc/librc.c
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2013-10-21 14:21:22 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2013-10-21 14:21:22 -0500
commitaeb670f4e8f56bae72511b08f8b3b5fa732ce7fc (patch)
treecdc6fecec3230bdd532b64c550926d10170a706f /src/librc/librc.c
parent48981be8a872c7a0191d2519793205276fdc423a (diff)
downloadopenrc-aeb670f4e8f56bae72511b08f8b3b5fa732ce7fc.tar.gz
openrc-aeb670f4e8f56bae72511b08f8b3b5fa732ce7fc.tar.bz2
openrc-aeb670f4e8f56bae72511b08f8b3b5fa732ce7fc.tar.xz
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
Diffstat (limited to 'src/librc/librc.c')
-rw-r--r--src/librc/librc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index cb4ce63..d7a4849 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -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))