]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: hlua: Fix integer underflow when receiving line from lua cosocket
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 22 May 2026 14:11:52 +0000 (16:11 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 22 May 2026 15:17:01 +0000 (17:17 +0200)
commit9091cfa617a4f593785b6093548dff70a07b1e0f
tree034871343e793db60a51e27cbd84c9af4e59e8f6
parent57b526e0224cd6523689a0ecd05efd7f28f1edf0
BUG/MEDIUM: hlua: Fix integer underflow when receiving line from lua cosocket

In hlua_socket_receive_yield(), when we try to get a line, the trailing CRLF is
stripped by decrementing the block length. The '\n' is first skipped, then,
possible a preceeding '\r'. But the block lenght is never checked. If an empty
line is returned, this leads to an integer underflow and most probably to a
crash because this length is used to copy data into a LUA string.

To fix the issue, the block length is now properly tested against 0 before
decrementing it.

This patch must be backported to all stable versions.
src/hlua.c