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].
This commit is contained in:
parent
40f7046696
commit
a9fc26ac13
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user