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).
This commit is contained in:
Dan Fandrich
2008-11-07 18:33:20 +00:00
parent 95a849efc2
commit 6354cbf9d6
3 changed files with 9 additions and 2 deletions

View File

@@ -6,6 +6,11 @@
Changelog 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) Yang Tse (6 Nov 2008)
- Merged existing IPv4 and IPv6 Curl_ip2addr functions into a single one - Merged existing IPv4 and IPv6 Curl_ip2addr functions into a single one
which now also takes a protocol address family argument. which now also takes a protocol address family argument.

View File

@@ -14,6 +14,7 @@ This release includes the following changes:
This release includes the following bugfixes: This release includes the following bugfixes:
o build failure when using MSVC 6 makefile 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: 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 This release would not have looked like this without help, code, reports and
advice from friends like these: advice from friends like these:
John Wilkinson John Wilkinson, Adam Sampson
Thanks! (and sorry if I forgot to mention someone) Thanks! (and sorry if I forgot to mention someone)

View File

@@ -78,7 +78,8 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
if (getifaddrs(&head) >= 0) { if (getifaddrs(&head) >= 0) {
for (iface=head; iface != NULL; iface=iface->ifa_next) { 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)) { curl_strequal(iface->ifa_name, interface)) {
void *addr; void *addr;
char scope[12]=""; char scope[12]="";