summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getgrent.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1995-09-05 19:52:59 +0000
committerwpaul <wpaul@FreeBSD.org>1995-09-05 19:52:59 +0000
commit19fa40652b30e6ddbdaff1012f33a8b142540c26 (patch)
treeb9071750e8f558f5bf751447c7e23bc22298de0a /lib/libc/gen/getgrent.c
parent7707033132b6f04d87811335cb72e1e0b500ffd7 (diff)
downloadFreeBSD-src-19fa40652b30e6ddbdaff1012f33a8b142540c26.zip
FreeBSD-src-19fa40652b30e6ddbdaff1012f33a8b142540c26.tar.gz
getgrent.c: adjust _nextypgroup() slightly so that it continues processing
the group map after encountering a badly formatted entry. getpwent.c: same as above for _nextyppass(), and also turn a couple of sprintf()s into snprintf()s to avoid potential buffer overruns. (The other day I nearly went mad because of a username in my NIS database that's actually 9 characters long instead of 8. Stuffing a 9-character username into an 8-character buffer can do some strange things.) (This reminds me: I hope somebody's planning to fix the buffer overrun security hole in syslog(3) before 2.1 ships.)
Diffstat (limited to 'lib/libc/gen/getgrent.c')
-rw-r--r--lib/libc/gen/getgrent.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 0d393be..d4e0794 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -409,7 +409,10 @@ unpack:
strcpy(resultbuf, result);
free(result);
if(result = strchr(resultbuf, '\n')) *result = '\0';
- return(_gr_breakout_yp(gr, resultbuf));
+ if (_gr_breakout_yp(gr, resultbuf))
+ return(1);
+ else
+ goto tryagain;
}
}
OpenPOWER on IntegriCloud