From 6354cbf9d6b1f16544c69d8a9d2b7816768da11b Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 7 Nov 2008 18:33:20 +0000 Subject: The getifaddrs() version of Curl_if2ip() crashed when used on a Linux system with a TEQL load-balancing device configured, which doesn't have an address. Thanks to Adam Sampson for spotting this (bug #2234923). --- CHANGES | 5 +++++ RELEASE-NOTES | 3 ++- lib/if2ip.c | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index cfac2d8a0..71d3b52b7 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,11 @@ Changelog +Daniel Fandrich (7 Nov 2008) +- The getifaddrs() version of Curl_if2ip() crashed when used on a Linux + system with a TEQL load-balancing device configured, which doesn't + have an address. Thanks to Adam Sampson for spotting this (bug #2234923). + Yang Tse (6 Nov 2008) - Merged existing IPv4 and IPv6 Curl_ip2addr functions into a single one which now also takes a protocol address family argument. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b9fb47bc0..1d8d76d81 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -14,6 +14,7 @@ This release includes the following changes: This release includes the following bugfixes: o build failure when using MSVC 6 makefile + o crash when using --interface name on Linux systems with a TEQL device This release includes the following known bugs: @@ -26,6 +27,6 @@ Other curl-related news: This release would not have looked like this without help, code, reports and advice from friends like these: - John Wilkinson + John Wilkinson, Adam Sampson Thanks! (and sorry if I forgot to mention someone) diff --git a/lib/if2ip.c b/lib/if2ip.c index 9faa3b67a..c591a957a 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -78,7 +78,8 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size) if (getifaddrs(&head) >= 0) { for (iface=head; iface != NULL; iface=iface->ifa_next) { - if ((iface->ifa_addr->sa_family == af) && + if ((iface->ifa_addr != NULL) && + (iface->ifa_addr->sa_family == af) && curl_strequal(iface->ifa_name, interface)) { void *addr; char scope[12]=""; -- cgit v1.2.3