Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jun 2016 01:11:48 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r301710 - head/lib/libc/gen
Message-ID:  <201606090111.u591BmNn003307@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606090111.u591BmNn003307>