Fortify the sanity-checks
Hiltjo made a good start, but we need to check both the pointers and the first value to make sure that a NULL-pointer is not passed to the functions.
This commit is contained in:
parent
8aa3e3f48f
commit
bd9d7e3493
1 changed files with 2 additions and 2 deletions
4
quark.c
4
quark.c
|
@ -553,9 +553,9 @@ main(int argc, char *argv[]) {
|
|||
} ARGEND;
|
||||
|
||||
/* sanity checks */
|
||||
if (*user && !(upwd = getpwnam(user)))
|
||||
if (user && *user && !(upwd = getpwnam(user)))
|
||||
die("error\tinvalid user %s\n", user);
|
||||
if (*group && !(gpwd = getgrnam(group)))
|
||||
if (group && *group && !(gpwd = getgrnam(group)))
|
||||
die("error\tinvalid group %s\n", group);
|
||||
|
||||
signal(SIGCHLD, sighandler);
|
||||
|
|
Loading…
Reference in a new issue