mirror of
https://github.com/moparisthebest/curl
synced 2024-11-12 04:25:08 -05:00
url.c: fix parse_url_login() OOM handling
This commit is contained in:
parent
2af64c6432
commit
cfc907e43d
18
lib/url.c
18
lib/url.c
@ -4440,8 +4440,12 @@ static CURLcode parse_url_login(struct SessionHandle *data,
|
|||||||
|
|
||||||
/* Decode the user */
|
/* Decode the user */
|
||||||
newname = curl_easy_unescape(data, userp, 0, NULL);
|
newname = curl_easy_unescape(data, userp, 0, NULL);
|
||||||
if(!newname)
|
if(!newname) {
|
||||||
|
Curl_safefree(userp);
|
||||||
|
Curl_safefree(passwdp);
|
||||||
|
Curl_safefree(optionsp);
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
if(strlen(newname) < MAX_CURL_USER_LENGTH)
|
if(strlen(newname) < MAX_CURL_USER_LENGTH)
|
||||||
strcpy(user, newname);
|
strcpy(user, newname);
|
||||||
@ -4452,8 +4456,12 @@ static CURLcode parse_url_login(struct SessionHandle *data,
|
|||||||
if(passwdp) {
|
if(passwdp) {
|
||||||
/* We have a password in the URL so decode it */
|
/* We have a password in the URL so decode it */
|
||||||
char *newpasswd = curl_easy_unescape(data, passwdp, 0, NULL);
|
char *newpasswd = curl_easy_unescape(data, passwdp, 0, NULL);
|
||||||
if(!newpasswd)
|
if(!newpasswd) {
|
||||||
|
Curl_safefree(userp);
|
||||||
|
Curl_safefree(passwdp);
|
||||||
|
Curl_safefree(optionsp);
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
if(strlen(newpasswd) < MAX_CURL_PASSWORD_LENGTH)
|
if(strlen(newpasswd) < MAX_CURL_PASSWORD_LENGTH)
|
||||||
strcpy(passwd, newpasswd);
|
strcpy(passwd, newpasswd);
|
||||||
@ -4464,8 +4472,12 @@ static CURLcode parse_url_login(struct SessionHandle *data,
|
|||||||
if(optionsp) {
|
if(optionsp) {
|
||||||
/* We have an options list in the URL so decode it */
|
/* We have an options list in the URL so decode it */
|
||||||
char *newoptions = curl_easy_unescape(data, optionsp, 0, NULL);
|
char *newoptions = curl_easy_unescape(data, optionsp, 0, NULL);
|
||||||
if(!newoptions)
|
if(!newoptions) {
|
||||||
|
Curl_safefree(userp);
|
||||||
|
Curl_safefree(passwdp);
|
||||||
|
Curl_safefree(optionsp);
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
if(strlen(newoptions) < MAX_CURL_OPTIONS_LENGTH)
|
if(strlen(newoptions) < MAX_CURL_OPTIONS_LENGTH)
|
||||||
strcpy(options, newoptions);
|
strcpy(options, newoptions);
|
||||||
|
Loading…
Reference in New Issue
Block a user