diff options
author | Yang Tse <yangsita@gmail.com> | 2011-09-30 20:56:56 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-09-30 21:10:58 +0200 |
commit | 7be872c389a4cc97a4594912d1e0bdd865974780 (patch) | |
tree | dfec3268260596d189ad5f60721e3c4a727fae81 /src/tool_cb_hdr.c | |
parent | 0c903ea18962ef51984733afc28f4f811c4788c5 (diff) | |
download | curl-7be872c389a4cc97a4594912d1e0bdd865974780.tar.gz |
curl tool: fix some more OOM handling
Diffstat (limited to 'src/tool_cb_hdr.c')
-rw-r--r-- | src/tool_cb_hdr.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c index 15657867d..06ced4541 100644 --- a/src/tool_cb_hdr.c +++ b/src/tool_cb_hdr.c @@ -56,6 +56,9 @@ size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata) */ size_t failure = (size * nmemb) ? 0 : 1; + if(!outs->config) + return failure; + #ifdef DEBUGBUILD if((size * nmemb > (size_t)CURL_MAX_WRITE_SIZE) || (size * nmemb > (size_t)CURL_MAX_HTTP_HEADER)) { @@ -64,7 +67,8 @@ size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata) } #endif - if(cb > 20 && checkprefix("Content-disposition:", str)) { + if(!outs->filename && (cb > 20) && + checkprefix("Content-disposition:", str)) { const char *p = str + 20; /* look for the 'filename=' parameter @@ -94,6 +98,9 @@ size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata) if(filename) { outs->filename = filename; outs->alloc_filename = TRUE; + outs->s_isreg = TRUE; + outs->fopened = FALSE; + outs->stream = NULL; break; } else |