Commit b13d71d5 by pdw

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
parent 02962521
...@@ -117,6 +117,10 @@ char* do_resolve(struct addr_storage *addr) { ...@@ -117,6 +117,10 @@ char* do_resolve(struct addr_storage *addr) {
/* Allocate buffer, remember to free it to avoid memory leakage. */ /* Allocate buffer, remember to free it to avoid memory leakage. */
tmphstbuf = xmalloc (hstbuflen); 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 /* Some machines have gethostbyaddr_r returning an integer error code; on
* others, it returns a struct hostent*. */ * others, it returns a struct hostent*. */
#ifdef GETHOSTBYADDR_R_RETURNS_INT #ifdef GETHOSTBYADDR_R_RETURNS_INT
...@@ -135,6 +139,7 @@ char* do_resolve(struct addr_storage *addr) { ...@@ -135,6 +139,7 @@ char* do_resolve(struct addr_storage *addr) {
hstbuflen *= 2; hstbuflen *= 2;
tmphstbuf = realloc (tmphstbuf, hstbuflen); tmphstbuf = realloc (tmphstbuf, hstbuflen);
} }
}
/* Check for errors. */ /* Check for errors. */
if (res || hp == NULL) { if (res || hp == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment