summaryrefslogtreecommitdiff
path: root/src/tool_cb_wrt.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-09-26 13:07:34 +0200
committerYang Tse <yangsita@gmail.com>2011-09-26 13:07:34 +0200
commitf4853db5e601030690dfbd78119a38999d6e1577 (patch)
tree6a582454e09ca4de50f79c38f63b805543e64409 /src/tool_cb_wrt.c
parentd9f686db88cc6ed01af8f7d690a9e44b7dcfb6ee (diff)
downloadcurl-f4853db5e601030690dfbd78119a38999d6e1577.tar.gz
curl tool: fix some OOM handling
Diffstat (limited to 'src/tool_cb_wrt.c')
-rw-r--r--src/tool_cb_wrt.c7
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) {