]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: htx: Catch chunk_memcat() failures when HTX data are formatted to h1
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Oct 2019 12:36:51 +0000 (14:36 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Oct 2019 14:42:46 +0000 (16:42 +0200)
commite0f8dc576f62ace9ad1055ca068ab5d4f3a952aa
treea2dafa9c6d28ee1479ac0440c087658bfbc8534c
parent4a66013069ab4195acabb212b39345fd41eda075
BUG/MEDIUM: htx: Catch chunk_memcat() failures when HTX data are formatted to h1

In functions htx_*_to_h1(), most of time several calls to chunk_memcat() are
chained. The expected size is always compared to available room in the buffer to
be sure the full copy will succeed. But it is a bit risky because it relies on
the fact the function chunk_memcat() evaluates the available room in the buffer
in a same way than htx ones. And, unfortunately, it does not. A bug in
chunk_memcat() will always leave a byte unused in the buffer. So, for instance,
when a chunk is copied in an almost full buffer, the last CRLF may be skipped.

To fix the issue, we now rely on the result of chunk_memcat() only.

This patch must be backported to 2.0 and 1.9.
src/htx.c