/* start-line -> HEADERS h3 frame */
BUG_ON(sl);
sl = htx_get_blk_ptr(htx, blk);
- /* TODO should be on h3 layer */
status = sl->info.res.status;
+ if (status < 100 || status > 999) {
+ TRACE_ERROR("invalid response status code", H3_EV_STRM_SEND, qcs->qcc->conn, qcs);
+ goto err;
+ }
}
else if (type == HTX_BLK_HDR) {
if (unlikely(hdr >= sizeof(list) / sizeof(list[0]) - 1)) {
}
}
+ /* Current function expects HTX start-line to be present. This also
+ * ensures <status> conformance has been checked prior to encoding it.
+ */
BUG_ON(!sl);
list[hdr].n = ist("");
if (qpack_encode_field_section_line(&headers_buf))
goto err_full;
if (qpack_encode_int_status(&headers_buf, status)) {
- /* TODO handle invalid status code VS no buf space left */
TRACE_ERROR("error during status code encoding", H3_EV_TX_FRAME|H3_EV_TX_HDR, qcs->qcc->conn, qcs);
goto err_full;
}
{
int status_size, idx = 0;
- if (status < 100 || status > 999)
- return 1;
+ /* HTTP layer must not encode invalid status codes. */
+ BUG_ON(status < 100 || status > 999);
switch (status) {
case 103: idx = 24; break;