From: Ben Gras Date: Sat, 24 Jul 2010 10:40:55 +0000 (+0000) Subject: lib - sanity check for group_from_gid etc. X-Git-Tag: v3.1.8~145 X-Git-Url: http://zhaoyanbai.com/repos/dig.html?a=commitdiff_plain;h=9f0364df60acf729c44c04ddc1b7ddc795cefb1b;p=minix.git lib - sanity check for group_from_gid etc. --- diff --git a/lib/libc/other/pwcache.c b/lib/libc/other/pwcache.c index bf3f366d9..0505e46c4 100644 --- a/lib/libc/other/pwcache.c +++ b/lib/libc/other/pwcache.c @@ -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