diff options
author | ngie <ngie@FreeBSD.org> | 2016-06-10 15:42:17 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-06-10 15:42:17 +0000 |
commit | 121e04bca5edfe20f7c5ad17fce71a188091db1e (patch) | |
tree | b004c87d1a06cd5aef0ce4ae24205a356cfb518a /lib/libc | |
parent | d27f917a308397d44e35f1b10872bed96c6d7f8d (diff) | |
download | FreeBSD-src-121e04bca5edfe20f7c5ad17fce71a188091db1e.zip FreeBSD-src-121e04bca5edfe20f7c5ad17fce71a188091db1e.tar.gz |
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
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/tests/nss/gethostby_test.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/tests/nss/gethostby_test.c b/lib/libc/tests/nss/gethostby_test.c index bdeafbc..618f747 100644 --- a/lib/libc/tests/nss/gethostby_test.c +++ b/lib/libc/tests/nss/gethostby_test.c @@ -893,7 +893,7 @@ hostent_test_getnameinfo_eq(struct hostent *he, void *mdata) 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], |