summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-06-08 23:21:45 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-06-08 23:21:45 +0200
commitba3a5c4d12df3b8c3cf968df425f50a4f70d0334 (patch)
tree1659379096bfc42a7a542fc24ed313cfd37c1274
parent4ae6b5bb855bd63464c78fe37598f4655bf7d801 (diff)
downloadcurl-bagder/bind-ipversion-mismatch.tar.gz
bindlocal: detect and avoid IP version mismatches in bind()bagder/bind-ipversion-mismatch
Reported-by: Alex Grebenschikov Fixes #3993
-rw-r--r--lib/connect.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 002535b42..4a1f2c640 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -368,6 +368,11 @@ static CURLcode bindlocal(struct connectdata *conn,
infof(data, "Name '%s' family %i resolved to '%s' family %i\n",
dev, af, myhost, h->addr->ai_family);
Curl_resolv_unlock(data, h);
+ if(af != h->addr->ai_family) {
+ /* bad IP version combo, signal the caller to try another address
+ family if available */
+ return CURLE_UNSUPPORTED_PROTOCOL;
+ }
done = 1;
}
else {