summaryrefslogtreecommitdiff
path: root/lib/if2ip.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2008-11-07 18:33:20 +0000
committerDan Fandrich <dan@coneharvesters.com>2008-11-07 18:33:20 +0000
commit6354cbf9d6b1f16544c69d8a9d2b7816768da11b (patch)
treec1d521c977e675ecd159234a86f9ac68d55ea0cd /lib/if2ip.c
parent95a849efc2e37de5d45fbdadd04f00ff794e1307 (diff)
downloadcurl-6354cbf9d6b1f16544c69d8a9d2b7816768da11b.tar.gz
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).
Diffstat (limited to 'lib/if2ip.c')
-rw-r--r--lib/if2ip.c3
1 files changed, 2 insertions, 1 deletions
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]="";