From aeb670f4e8f56bae72511b08f8b3b5fa732ce7fc Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Mon, 21 Oct 2013 14:21:22 -0500 Subject: [PATCH] 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 --- src/librc/librc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librc/librc.c b/src/librc/librc.c index cb4ce63e..d7a4849a 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))