summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdw <>2014-01-01 12:01:57 +0000
committerpdw <>2014-01-01 12:01:57 +0000
commitb13d71d5a2adc794bc413e4ef326d9a864019dd7 (patch)
treec42312ef4ee00e55bc45620fb30ee1e2f8363aee
parent029625219bf401345016414883866d4beddfe0b6 (diff)
downloadiftop-b13d71d5a2adc794bc413e4ef326d9a864019dd7.zip
Patch by Robert Scheck <robert@fedoraproject.org> for iftop <= 1.0pre2 to avoid an
assertion failure if an "invalid" (as in outside of IPv4 or IPv6) address family is passed to nss-myhostname's gethostbyaddr_r(). For further information please have a look to Red Hat Bugzilla IDs #839750, #847124, #868065, #961236 and #1007434: - https://bugzilla.redhat.com/show_bug.cgi?id=839750 - https://bugzilla.redhat.com/show_bug.cgi?id=847124 - https://bugzilla.redhat.com/show_bug.cgi?id=868065 - https://bugzilla.redhat.com/show_bug.cgi?id=961236 - https://bugzilla.redhat.com/show_bug.cgi?id=1007434
-rw-r--r--resolver.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/resolver.c b/resolver.c
index 3ca8835..b42e544 100644
--- a/resolver.c
+++ b/resolver.c
@@ -117,6 +117,10 @@ char* do_resolve(struct addr_storage *addr) {
/* Allocate buffer, remember to free it to avoid memory leakage. */
tmphstbuf = xmalloc (hstbuflen);
+ /* nss-myhostname's gethostbyaddr_r() causes an assertion failure if an
+ * "invalid" (as in outside of IPv4 or IPv6) address family is passed */
+ if (addr->af == AF_INET || addr->af == AF_INET6) {
+
/* Some machines have gethostbyaddr_r returning an integer error code; on
* others, it returns a struct hostent*. */
#ifdef GETHOSTBYADDR_R_RETURNS_INT
@@ -135,6 +139,7 @@ char* do_resolve(struct addr_storage *addr) {
hstbuflen *= 2;
tmphstbuf = realloc (tmphstbuf, hstbuflen);
}
+ }
/* Check for errors. */
if (res || hp == NULL) {