diff options
Diffstat (limited to 'lib/cookie.c')
-rw-r--r-- | lib/cookie.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/cookie.c b/lib/cookie.c index d31bcd114..66309d767 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -149,7 +149,7 @@ Curl_cookie_add(struct SessionHandle *data, unless set */ { struct Cookie *clist; - char what[MAX_COOKIE_LINE]; + char *what; char name[MAX_NAME]; char *ptr; char *semiptr; @@ -167,6 +167,13 @@ Curl_cookie_add(struct SessionHandle *data, if(httpheader) { /* This line was read off a HTTP-header */ char *sep; + + what = malloc(MAX_COOKIE_LINE); + if(!what) { + free(co); + return NULL; + } + semiptr=strchr(lineptr, ';'); /* first, find a semicolon */ while(*lineptr && isspace((int)*lineptr)) @@ -387,6 +394,8 @@ Curl_cookie_add(struct SessionHandle *data, } } + free(what); + if(badcookie || !co->name) { /* we didn't get a cookie name or a bad one, this is an illegal line, bail out */ |