svn commit: r299502 - head/lib/libc/tests/nss
Conrad E. Meyer
cem at FreeBSD.org
Thu May 12 02:32:24 UTC 2016
Author: cem
Date: Thu May 12 02:32:23 2016
New Revision: 299502
URL: https://svnweb.freebsd.org/changeset/base/299502
Log:
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.
Reported by: Coverity
CID: 1346578
Sponsored by: EMC / Isilon Storage Division
Modified:
head/lib/libc/tests/nss/gethostby_test.c
Modified: head/lib/libc/tests/nss/gethostby_test.c
==============================================================================
--- head/lib/libc/tests/nss/gethostby_test.c Thu May 12 02:05:50 2016 (r299501)
+++ head/lib/libc/tests/nss/gethostby_test.c Thu May 12 02:32:23 2016 (r299502)
@@ -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-head
mailing list