svn commit: r301798 - stable/10/lib/libc/tests/nss

Garrett Cooper ngie at FreeBSD.org
Fri Jun 10 15:42:18 UTC 2016


Author: ngie
Date: Fri Jun 10 15:42:17 2016
New Revision: 301798
URL: https://svnweb.freebsd.org/changeset/base/301798

Log:
  MFC r299502:
  r299502 (by cem):
  
  nss/gethostby_test: fix broken vector iteration of gethostbyaddr h_aliases
  
  h_aliases is a NULL-terminated rather than fixed-length array.  nitems() is not
  a valid way to determine its end; instead, check for NULL.
  
  CID:		1346578

Modified:
  stable/10/lib/libc/tests/nss/gethostby_test.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/tests/nss/gethostby_test.c
==============================================================================
--- stable/10/lib/libc/tests/nss/gethostby_test.c	Fri Jun 10 15:05:35 2016	(r301797)
+++ stable/10/lib/libc/tests/nss/gethostby_test.c	Fri Jun 10 15:42:17 2016	(r301798)
@@ -893,7 +893,7 @@ hostent_test_getnameinfo_eq(struct hoste
 			printf("matched official hostname\n");
 #endif
 		} else {
-			for (i = 0; i < nitems(result->h_aliases); i++) {
+			for (i = 0; result->h_aliases[i] != NULL; i++) {
 				printf("[%d] resolved: %s\n", i,
 				    result->h_aliases[i]);
 				if (strcmp(result->h_aliases[i],


More information about the svn-src-stable mailing list