From: Amaury Denoyelle Date: Tue, 24 Aug 2021 14:29:49 +0000 (+0200) Subject: MINOR: quic-enc: fix varint encoding X-Git-Tag: v2.5-dev8~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a4f0d85be99e26056e3f6512a10c54c280a407f;p=thirdparty%2Fhaproxy.git MINOR: quic-enc: fix varint encoding --- diff --git a/include/haproxy/quic_enc.h b/include/haproxy/quic_enc.h index 3222a27d7a..9a18824013 100644 --- a/include/haproxy/quic_enc.h +++ b/include/haproxy/quic_enc.h @@ -187,7 +187,7 @@ static inline int quic_enc_int(unsigned char **buf, const unsigned char *end, ui static inline int b_quic_enc_int(struct buffer *b, uint64_t val) { unsigned int shift; - unsigned char size_bits, *head, *pos, *wrap; + unsigned char size_bits, *tail, *pos, *wrap; size_t save_len, len; size_t data = b_data(b); size_t size = b_size(b); @@ -202,7 +202,7 @@ static inline int b_quic_enc_int(struct buffer *b, uint64_t val) shift = (len - 1) * 8; /* set the bits of byte#0 which gives the length of the encoded integer */ size_bits = quic_log2(len) << QUIC_VARINT_BYTE_0_SHIFT; - pos = head = (unsigned char *)b_head(b); + pos = tail = (unsigned char *)b_tail(b); wrap = (unsigned char *)b_wrap(b); while (len--) { *pos++ = val >> shift; @@ -212,7 +212,7 @@ static inline int b_quic_enc_int(struct buffer *b, uint64_t val) if (++data == size && len) return 0; } - *head |= size_bits; + *tail |= size_bits; b_add(b, save_len); return 1;