commit 832f742ab1dae4f8d3b765d787dbb14d93e284fa
parent bdd4bc41a358e408bc039c7320ff7dd605923b9a
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Fri, 28 Aug 2026 17:29:31 +0200
HPACK: fixed missing position update when encoding ":status"
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mhd2/h2/hpack/mhd_hpack_codec.c b/src/mhd2/h2/hpack/mhd_hpack_codec.c
@@ -6328,6 +6328,7 @@ mhd_hpack_enc_field (struct mhd_HpackEncContext *restrict hk_enc,
else
mhd_assert (mhd_ENC_RESULT_INT_OK_NO_ADD_TO_DYN == enc_field_res);
+ mhd_assert (out_buff_size >= pos);
*bytes_encoded = pos;
return mhd_HPACK_ENC_RES_OK;
}
@@ -6621,8 +6622,8 @@ mhd_hpack_enc_ph_status (struct mhd_HpackEncContext *restrict hk_enc,
code,
enc_pol,
code_str,
- out_buff_size,
- out_buff,
+ out_buff_size - pos,
+ out_buff + pos,
&pos_incr);
if (mhd_ENC_RESULT_INT_NO_SPACE == enc_field_res)
@@ -6648,6 +6649,7 @@ mhd_hpack_enc_ph_status (struct mhd_HpackEncContext *restrict hk_enc,
else
mhd_assert (mhd_ENC_RESULT_INT_OK_NO_ADD_TO_DYN == enc_field_res);
+ mhd_assert (out_buff_size >= pos);
*bytes_encoded = pos;
return mhd_HPACK_ENC_RES_OK;
}