Skip to content

Commit

Permalink
check resp->body before copying
Browse files Browse the repository at this point in the history
  • Loading branch information
scareything committed May 14, 2024
1 parent a727020 commit 64406c2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/ziti_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ static void ctrl_body_cb(tlsuv_http_req_t *req, char *b, ssize_t len) {
if (resp->resp_chunked) {
resp->body = realloc(resp->body, resp->received + len);
}
if (!resp->body) {
ZITI_LOG(WARN, "could not process controller response: %zd bytes not allocated for body", len);
return;
}
memcpy(resp->body + resp->received, b, len);
resp->received += len;
}
Expand Down

0 comments on commit 64406c2

Please sign in to comment.