diff options
author | Yang Tse <yangsita@gmail.com> | 2011-09-26 13:07:34 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-09-26 13:07:34 +0200 |
commit | f4853db5e601030690dfbd78119a38999d6e1577 (patch) | |
tree | 6a582454e09ca4de50f79c38f63b805543e64409 /src/tool_cb_wrt.c | |
parent | d9f686db88cc6ed01af8f7d690a9e44b7dcfb6ee (diff) | |
download | curl-f4853db5e601030690dfbd78119a38999d6e1577.tar.gz |
curl tool: fix some OOM handling
Diffstat (limited to 'src/tool_cb_wrt.c')
-rw-r--r-- | src/tool_cb_wrt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index 3a2cd791a..1889080de 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -51,6 +51,13 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata) */ const size_t err_rc = (sz * nmemb) ? 0 : 1; +#ifdef DEBUGBUILD + if(sz * nmemb > (size_t)CURL_MAX_WRITE_SIZE) { + warnf(config, "Data size exceeds single call write limit!\n"); + return err_rc; /* Failure */ + } +#endif + if(!out->stream) { out->bytes = 0; /* nothing written yet */ if(!out->filename) { |