]> git.kaiwu.me - haproxy.git/commit
CLEANUP: mux-h2: clarify that bptr is not NULL when calling to h2_get_buf()
authorWilly Tarreau <w@1wt.eu>
Mon, 9 Nov 2026 16:49:11 +0000 (17:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Nov 2026 19:48:35 +0000 (20:48 +0100)
commit2798a0a3a9e9b8e1266d3670cb5fea714d57348c
tree3ebae1d6c309f4c9c19fb35f903039f16c00df22
parent296acc6711784bb427bb1602aeac629033584338
CLEANUP: mux-h2: clarify that bptr is not NULL when calling to h2_get_buf()

In h2_frt_transfer_data(), we first check h2s_rxbuf_tail() and if it's
NULL, we get out. A bit later we pass that function's return to
h2_get_buf(), which dereferences it. It's OK since it was checked. But
depending on optimization levels and tiny extra fixes, gcc-9.5 (at least)
sometimes thinks it sees a possible null-deref and emits a warning. Let's
just use the known safe version of h2s_rxbuf_tail() since we know for sure
that the pointer is valid so that the compiler is no longer confused. A
comment was added at the top of the function to clarify that the pointer
may not be NULL.
src/mux_h2.c