]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Wrong STREAM frame length computing
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 25 Aug 2021 14:08:47 +0000 (16:08 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
The ->len and ->offset field of STREAM frame are optional.

include/haproxy/quic_frame.h

index f63e9b00727a35ad4c15551cd9457cc7017b1608..a5c022acce462e97f5572cc5c9d562e23af57240 100644 (file)
@@ -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: {