diff options
author | cem <cem@FreeBSD.org> | 2016-05-12 02:32:23 +0000 |
---|---|---|
committer | cem <cem@FreeBSD.org> | 2016-05-12 02:32:23 +0000 |
commit | c0a49a226519d7fb434146de32374d2f42078bb9 (patch) | |
tree | 745e3d8d5952f0d05a5df98740de5517a163de3c /lib/libc | |
parent | b3857d7c402e06970db2975dfb9c71ba6fd66fe6 (diff) | |
download | FreeBSD-src-c0a49a226519d7fb434146de32374d2f42078bb9.zip FreeBSD-src-c0a49a226519d7fb434146de32374d2f42078bb9.tar.gz |
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
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], |