Skip to content
Snippets Groups Projects
Commit 5bdda673 authored by Sergey Bronnikov's avatar Sergey Bronnikov Committed by Alexander Turenko
Browse files

httpc: replace ibuf_alloc with xibuf_alloc

There is no check for NULL for a value returned by `ibuf_alloc`,
the NULL will be passed to `memcpy()` if the aforementioned
function will return a NULL. The patch fixes that by replacing
`ibuf_alloc` with macros `xibuf_alloc` that never return NULL.

Found by Svace.

NO_CHANGELOG=codehealth
NO_DOC=codehealth
NO_TEST=codehealth

(cherry picked from commit b4ee146fde6e418aed590ac6054cff75c2a59626)
parent d615f3f7
No related branches found
No related tags found
No related merge requests found
......@@ -578,7 +578,7 @@ httpc_request_io_read(struct httpc_request *req, char *buf, size_t len,
if (recv_len > remain) {
const size_t tocopy = recv_len - remain;
char *ptr = ibuf_alloc(&req->io_recv, tocopy);
char *ptr = xibuf_alloc(&req->io_recv, tocopy);
memcpy(ptr, recv + remain, tocopy);
}
......@@ -626,7 +626,7 @@ httpc_request_io_write(struct httpc_request *req, const char *ptr, size_t len,
if (len > 0) {
ibuf_reset(&req->send);
char *buf = ibuf_alloc(&req->send, len);
char *buf = xibuf_alloc(&req->send, len);
memcpy(buf, ptr, len);
} else {
req->io_send_closed = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment