]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: buf: fix varint API post- vs pre- increment
authorWilly Tarreau <w@1wt.eu>
Thu, 21 Oct 2021 13:05:34 +0000 (15:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 21 Oct 2021 13:28:24 +0000 (15:28 +0200)
commitdd362b7b24ea24d8f3c882dab1a69cf78af7cc90
tree7e851bde0ed2eff4f3a3a09af48bff0983c7cad7
parentdcb696cd31d9c58a84705c74930f12c952b52874
BUG/MAJOR: buf: fix varint API post- vs pre- increment

A bogus test in b_get_varint(), b_put_varint(), b_peek_varint() shifts
the end of the buffer by one byte. Since the bug is the same in the read
and write functions, the buffer contents remain compatible, which explains
why this bug was not detected earlier. But if the buffer ends on an
aligned address or page, it can result in a one-byte overflow which will
typically cause a crash or an inconsistent behavior.

This API is only used by rings (e.g. for traces and boot messages) and
by DNS responses, so the probability to hit it is extremely low, but a
crash on boot was observed.

This must be backported to 2.2.
include/haproxy/buf.h