]> Zhao Yanbai Git Server - minix.git/commitdiff
lib - sanity check for group_from_gid etc.
authorBen Gras <ben@minix3.org>
Sat, 24 Jul 2010 10:40:55 +0000 (10:40 +0000)
committerBen Gras <ben@minix3.org>
Sat, 24 Jul 2010 10:40:55 +0000 (10:40 +0000)
lib/libc/other/pwcache.c

index bf3f366d90e653f81be76fb95fc778c2ef215ae8..0505e46c40a84afcaffcc19d602700b99c013528 100644 (file)
@@ -271,7 +271,8 @@ user_from_uid(uid_t uid, int noname)
 
        if ((uidtb == NULL) && (uidtb_start() < 0))
                return (NULL);
-
+       if (uid < 0)
+               return NULL;
        /*
         * see if we have this uid cached
         */
@@ -342,6 +343,8 @@ group_from_gid(gid_t gid, int noname)
 
        if ((gidtb == NULL) && (gidtb_start() < 0))
                return (NULL);
+       if (gid < 0)
+               return NULL;
 
        /*
         * see if we have this gid cached