diff options
author | Steve Holme <steve_holme@hotmail.com> | 2013-04-21 16:55:19 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-04-21 16:55:19 +0100 |
commit | 416ecc15845c4e6bf7ea6359d9c63adec3385f5b (patch) | |
tree | 99f110b5a3d12d68a6b79f10c8aa1f362921698d | |
parent | 455ba691a7250b312075a5d91ae89bbbe70d62aa (diff) |
url: Fixed crash when no username or password supplied for proxy
Fixed an issue in parse_proxy(), introduced in commit 11332577b3cb,
where an empty username or password (For example: http://:@example.com)
would cause a crash.
-rw-r--r-- | lib/url.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -4208,13 +4208,19 @@ static CURLcode parse_proxy(struct SessionHandle *data, username or password with reserved characters like ':' in them. */ Curl_safefree(conn->proxyuser); - conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL); + if(proxyuser) + conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL); + else + conn->proxyuser = strdup(""); if(!conn->proxyuser) res = CURLE_OUT_OF_MEMORY; else { Curl_safefree(conn->proxypasswd); - conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL); + if(proxypasswd) + conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL); + else + conn->proxypasswd = strdup(""); if(!conn->proxypasswd) res = CURLE_OUT_OF_MEMORY; |