Unverified Commit 1667d559 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

bindlocal: detect and avoid IP version mismatches in bind()

Reported-by: Alex Grebenschikov
Fixes #3993
Closes #4002
parent 094b5f35
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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 {