From ca9d32c785c5e425ccc1fbef15420a457a72bde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Wed, 25 Aug 2021 16:08:47 +0200 Subject: [PATCH] MINOR: quic: Wrong STREAM frame length computing The ->len and ->offset field of STREAM frame are optional. --- include/haproxy/quic_frame.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/haproxy/quic_frame.h b/include/haproxy/quic_frame.h index f63e9b007..a5c022acc 100644 --- a/include/haproxy/quic_frame.h +++ b/include/haproxy/quic_frame.h @@ -71,8 +71,9 @@ static inline size_t qc_frm_len(struct quic_frame *frm) } case QUIC_FT_STREAM_8 ... QUIC_FT_STREAM_F: { struct quic_stream *f = &frm->stream; - len += 1 + quic_int_getsize(f->id) + quic_int_getsize(f->offset) + - quic_int_getsize(f->len) + f->len; + len += 1 + quic_int_getsize(f->id) + + ((frm->type & QUIC_STREAM_FRAME_TYPE_OFF_BIT) ? quic_int_getsize(f->offset) : 0) + + ((frm->type & QUIC_STREAM_FRAME_TYPE_LEN_BIT) ? quic_int_getsize(f->len) : 0) + f->len; break; } case QUIC_FT_MAX_DATA: {