aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorphilhofer <phofer@umich.edu>2018-12-23 12:42:33 -0800
committerMike Frysinger <vapier@gmail.com>2018-12-23 21:01:39 -0500
commita9fc26ac1367ac887eab76007e8834dfe787edcd (patch)
tree3ff3fdc3f61053c7fea7ec9dc61ef732825378c8 /src/rc
parent40f70466969b340ee5e277c98a4b27a9117b795e (diff)
src/rc/supervise-daemon.c: do not pass NULL to strcmp
The following will cause a segfault due to NULL being passed to strcmp(3) $ RC_SVCNAME=foo supervise-daemon Fix the bounds check on argc in main. If argc<=1, then it is not safe to dereference argv[1].
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/supervise-daemon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index bf958607..fec85594 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -720,7 +720,7 @@ int main(int argc, char **argv)
eerrorx("%s: The RC_SVCNAME environment variable is not set", applet);
openlog(applet, LOG_PID, LOG_DAEMON);
- if (argc >= 1 && svcname && strcmp(argv[1], svcname))
+ if (argc <= 1 || strcmp(argv[1], svcname))
eerrorx("%s: the first argument is %s and must be %s",
applet, argv[1], svcname);