]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
The getifaddrs() version of Curl_if2ip() crashed when used on a Linux
authorDan Fandrich <dan@coneharvesters.com>
Fri, 7 Nov 2008 18:33:20 +0000 (18:33 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Fri, 7 Nov 2008 18:33:20 +0000 (18:33 +0000)
system with a TEQL load-balancing device configured, which doesn't
have an address.  Thanks to Adam Sampson for spotting this (bug #2234923).

CHANGES
RELEASE-NOTES
lib/if2ip.c

diff --git a/CHANGES b/CHANGES
index cfac2d8a07fd462f6ae34e71aaec5c9dfe32d4ed..71d3b52b7c17916f43f888e47dc1248b361a412e 100644 (file)
--- 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.
index b9fb47bc05c7768a277df1d41ba15c481756ed3e..1d8d76d813361c75e8dd2df8a0bae81e4b7a3eae 100644 (file)
@@ -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)
index 9faa3b67a6b6319cc3697a342c156e19e9754f72..c591a957af313d7fd0660ae33b0c28eacd2c6723 100644 (file)
@@ -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]="";