mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
if malloc fails, we must bail out nicely
This commit is contained in:
parent
7247041e21
commit
656d4b4c20
@ -558,6 +558,9 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
|
|||||||
char *dir = (char *)malloc(nread+1);
|
char *dir = (char *)malloc(nread+1);
|
||||||
char *store=dir;
|
char *store=dir;
|
||||||
char *ptr=&buf[4]; /* start on the first letter */
|
char *ptr=&buf[4]; /* start on the first letter */
|
||||||
|
|
||||||
|
if(!dir)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
/* Reply format is like
|
/* Reply format is like
|
||||||
257<space>"<directory-name>"<space><commentary> and the RFC959 says
|
257<space>"<directory-name>"<space><commentary> and the RFC959 says
|
||||||
@ -565,7 +568,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
|
|||||||
The directory name can contain any character; embedded double-quotes
|
The directory name can contain any character; embedded double-quotes
|
||||||
should be escaped by double-quotes (the "quote-doubling" convention).
|
should be escaped by double-quotes (the "quote-doubling" convention).
|
||||||
*/
|
*/
|
||||||
if(dir && ('\"' == *ptr)) {
|
if('\"' == *ptr) {
|
||||||
/* it started good */
|
/* it started good */
|
||||||
ptr++;
|
ptr++;
|
||||||
while(ptr && *ptr) {
|
while(ptr && *ptr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user