commit bd9d7e349346fd4664e134be1f8c5b162513b272
parent 8aa3e3f48f9e9dcc8cf4a51916c78d9406a06763
Author: FRIGN <dev@frign.de>
Date: Thu, 14 Aug 2014 17:48:37 +0200
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.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/quark.c b/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);