summaryrefslogtreecommitdiff
path: root/lib/c-hyper.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-05-28 12:31:55 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-05-28 15:08:11 +0200
commitf2619b17677b103577eeb1d57859c1df479a5213 (patch)
tree6256ed98b61b34c6030ebe107c7b099b84ac7e1a /lib/c-hyper.c
parent68975fba02d760b3f00632ad62c00a5f88605003 (diff)
downloadcurl-f2619b17677b103577eeb1d57859c1df479a5213.tar.gz
c-hyper: handle NULL from hyper_buf_copy()
Closes #7143
Diffstat (limited to 'lib/c-hyper.c')
-rw-r--r--lib/c-hyper.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/c-hyper.c b/lib/c-hyper.c
index be4618eba..0f307f3e8 100644
--- a/lib/c-hyper.c
+++ b/lib/c-hyper.c
@@ -532,8 +532,12 @@ static int uploadpostfields(void *userdata, hyper_context *ctx,
*chunk = NULL; /* nothing more to deliver */
else {
/* send everything off in a single go */
- *chunk = hyper_buf_copy(data->set.postfields,
- (size_t)data->req.p.http->postsize);
+ hyper_buf *copy = hyper_buf_copy(data->set.postfields,
+ (size_t)data->req.p.http->postsize);
+ if(copy)
+ *chunk = copy;
+ else
+ return HYPER_POLL_ERROR;
data->req.upload_done = TRUE;
}
return HYPER_POLL_READY;
@@ -552,8 +556,13 @@ static int uploadstreamed(void *userdata, hyper_context *ctx,
if(!fillcount)
/* done! */
*chunk = NULL;
- else
- *chunk = hyper_buf_copy((uint8_t *)data->state.ulbuf, fillcount);
+ else {
+ hyper_buf *copy = hyper_buf_copy((uint8_t *)data->state.ulbuf, fillcount);
+ if(copy)
+ *chunk = copy;
+ else
+ return HYPER_POLL_ERROR;
+ }
return HYPER_POLL_READY;
}