Skip to content

Commit 1667d55

Browse files
committed
bindlocal: detect and avoid IP version mismatches in bind()
Reported-by: Alex Grebenschikov Fixes curl#3993 Closes curl#4002
1 parent 094b5f3 commit 1667d55

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/connect.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@ static CURLcode bindlocal(struct connectdata *conn,
368368
infof(data, "Name '%s' family %i resolved to '%s' family %i\n",
369369
dev, af, myhost, h->addr->ai_family);
370370
Curl_resolv_unlock(data, h);
371+
if(af != h->addr->ai_family) {
372+
/* bad IP version combo, signal the caller to try another address
373+
family if available */
374+
return CURLE_UNSUPPORTED_PROTOCOL;
375+
}
371376
done = 1;
372377
}
373378
else {

0 commit comments

Comments
 (0)