]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: htx: wrong count computation in htx_xfer_blks()
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 31 Jan 2025 13:41:28 +0000 (14:41 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 31 Jan 2025 14:02:58 +0000 (15:02 +0100)
commitc6390cdf9ce4e74540544207d6e3cfb31581eaea
tree38a8a23150f53c4238f3b179ea22abf59ae3ef95
parent956cb5d55405e38ce591111585a8c1ce30a482f8
BUG/MEDIUM: htx: wrong count computation in htx_xfer_blks()

When transfering blocks from an src to another dst htx representation,
htx_xfer_blks() decreases the size of each block removed from the <count>
value passed in parameter, so it can't transfer more than <count>. The
size must also contains the metadata, represented by a simple
sizeof(struct htk_blk).

However, the code was doing a sizeof(dstblk) instead of a
sizeof(*dstblk) which as the consequence of removing only a size_t from
count. Fortunately htx_blk size is 64bits, so that does not provoke any
problem in 64bits. But on 32bits architecture, the count value is not
decreased correctly and the function could try to transfer more blocks
than allowed by the count parameter.

Must be backported in every stable release.
src/htx.c