mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
bail out when no memory occurs
This commit is contained in:
parent
05d8e56ffd
commit
b121e41ec3
12
lib/url.c
12
lib/url.c
@ -2886,9 +2886,11 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
|
|
||||||
if(user[0]) {
|
if(user[0]) {
|
||||||
char *newname=curl_unescape(user, 0);
|
char *newname=curl_unescape(user, 0);
|
||||||
if(strlen(newname) < sizeof(user)) {
|
if(!newname)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
if(strlen(newname) < sizeof(user))
|
||||||
strcpy(user, newname);
|
strcpy(user, newname);
|
||||||
}
|
|
||||||
/* if the new name is longer than accepted, then just use
|
/* if the new name is longer than accepted, then just use
|
||||||
the unconverted name, it'll be wrong but what the heck */
|
the unconverted name, it'll be wrong but what the heck */
|
||||||
free(newname);
|
free(newname);
|
||||||
@ -2896,9 +2898,11 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
if (passwd[0]) {
|
if (passwd[0]) {
|
||||||
/* we have a password found in the URL, decode it! */
|
/* we have a password found in the URL, decode it! */
|
||||||
char *newpasswd=curl_unescape(passwd, 0);
|
char *newpasswd=curl_unescape(passwd, 0);
|
||||||
if(strlen(newpasswd) < sizeof(passwd)) {
|
if(!newpasswd)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
if(strlen(newpasswd) < sizeof(passwd))
|
||||||
strcpy(passwd, newpasswd);
|
strcpy(passwd, newpasswd);
|
||||||
}
|
|
||||||
free(newpasswd);
|
free(newpasswd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user