[hackers] [quark] Fortify the sanity-checks || FRIGN

From: <git_AT_suckless.org>
Date: Thu, 14 Aug 2014 17:47:51 +0200

commit bd9d7e349346fd4664e134be1f8c5b162513b272
Author: FRIGN <dev_AT_frign.de>
Date: Thu Aug 14 17:48:37 2014 +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.

diff --git a/quark.c b/quark.c
index bae9808..27ec6a6 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -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 invalid user %s
", user);
- if (*group && !(gpwd = getgrnam(group)))
+ if (group && *group && !(gpwd = getgrnam(group)))
                 die("error invalid group %s
", group);
 
         signal(SIGCHLD, sighandler);
Received on Thu Aug 14 2014 - 17:47:51 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 14 2014 - 17:48:08 CEST