diff options
author | markj <markj@FreeBSD.org> | 2016-06-09 01:11:48 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2016-06-09 01:11:48 +0000 |
commit | a7caa41829f894b5b21f9a9483f17d3f1c6a3cf9 (patch) | |
tree | 03f5ac9c166a2a53d55f6387faea6dfd59854bba /lib/libc/gen | |
parent | e07517fb7d4e88e7eb823cc8d48914627cd13a71 (diff) | |
download | FreeBSD-src-a7caa41829f894b5b21f9a9483f17d3f1c6a3cf9.zip FreeBSD-src-a7caa41829f894b5b21f9a9483f17d3f1c6a3cf9.tar.gz |
Fix an infinite loop in setnetgrent(3) with NIS netgroups.
Handle an empty result from yp_match() by returning NULL, which is
consistent with the handling of an empty netgroup in /etc/netgroup.
setnetgrent(3) has no return value, so there is no particular need to
distinguish this case from an error.
PR: 26486
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 71a36e2..ab3a46f 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -558,6 +558,10 @@ read_for_group(const char *group) continue; } } + if (strlen(result) == 0) { + free(result); + return (NULL); + } snprintf(line, LINSIZ, "%s %s", group, result); free(result); } |