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
--- iftop-1.0pre2/resolver.c 2013-12-18 23:41:50.000000000 +0100
+++ iftop-1.0pre2/resolver.c.nss-myhostname 2013-12-18 23:51:25.000000000 +0100
@@ -117,6 +117,10 @@
/* 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 @@
hstbuflen *= 2;
tmphstbuf = realloc (tmphstbuf, hstbuflen);
}
+ }
/* Check for errors. */
if (res || hp == NULL) {