svn commit: r301710 - head/lib/libc/gen

Mark Johnston markj at FreeBSD.org
Thu Jun 9 01:11:49 UTC 2016


Author: markj
Date: Thu Jun  9 01:11:48 2016
New Revision: 301710
URL: https://svnweb.freebsd.org/changeset/base/301710

Log:
  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

Modified:
  head/lib/libc/gen/getnetgrent.c

Modified: head/lib/libc/gen/getnetgrent.c
==============================================================================
--- head/lib/libc/gen/getnetgrent.c	Thu Jun  9 01:05:23 2016	(r301709)
+++ head/lib/libc/gen/getnetgrent.c	Thu Jun  9 01:11:48 2016	(r301710)
@@ -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);
 		}


More information about the svn-src-head mailing list