Skip to content

Commit

Permalink
bindlocal: detect and avoid IP version mismatches in bind()
Browse files Browse the repository at this point in the history
Reported-by: Alex Grebenschikov
Fixes #3993
Closes #4002
  • Loading branch information
bagder committed Jun 10, 2019
1 parent 094b5f3 commit 1667d55
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1667d55

Please sign in to comment.