Previously, the reservation passed to njs_chb_sprintf() was too
small for the maximum size_t output, so the header could be
silently truncated for very large request bodies.
}
if (request->body.len != 0) {
- njs_chb_sprintf(&http->chain, 32, "Content-Length: %uz" CRLF CRLF,
- request->body.len);
+ njs_chb_sprintf(&http->chain,
+ sizeof("Content-Length: " CRLF CRLF) - 1
+ + NGX_SIZE_T_LEN,
+ "Content-Length: %uz" CRLF CRLF, request->body.len);
njs_chb_append(&http->chain, request->body.data, request->body.len);
} else {