diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2016-05-12 02:32:23 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2016-05-12 02:32:23 +0000 |
commit | a03cc61df4964a782e149def544c621fe2cd8e32 (patch) | |
tree | 745e3d8d5952f0d05a5df98740de5517a163de3c | |
parent | ac97203f5ba4d912c9f4bc99e794e9d9de1f8ed5 (diff) | |
download | src-a03cc61df4964a782e149def544c621fe2cd8e32.tar.gz src-a03cc61df4964a782e149def544c621fe2cd8e32.zip |
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
Notes
Notes:
svn path=/head/; revision=299502
-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 bdeafbcdf693..618f7470920b 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], |