Commit 416ecc15 authored by Steve Holme's avatar Steve Holme
Browse files

url: Fixed crash when no username or password supplied for proxy

Fixed an issue in parse_proxy(), introduced in commit 11332577,
where an empty username or password (For example: http://:@example.com)
would cause a crash.
parent 455ba691
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -4208,13 +4208,19 @@ static CURLcode parse_proxy(struct SessionHandle *data,
         username or password with reserved characters like ':' in
         username or password with reserved characters like ':' in
         them. */
         them. */
      Curl_safefree(conn->proxyuser);
      Curl_safefree(conn->proxyuser);
      if(proxyuser)
        conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL);
        conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL);
      else
        conn->proxyuser = strdup("");


      if(!conn->proxyuser)
      if(!conn->proxyuser)
        res = CURLE_OUT_OF_MEMORY;
        res = CURLE_OUT_OF_MEMORY;
      else {
      else {
        Curl_safefree(conn->proxypasswd);
        Curl_safefree(conn->proxypasswd);
        if(proxypasswd)
          conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL);
          conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL);
        else
          conn->proxypasswd = strdup("");


        if(!conn->proxypasswd)
        if(!conn->proxypasswd)
          res = CURLE_OUT_OF_MEMORY;
          res = CURLE_OUT_OF_MEMORY;