BUG/MINOR: proxy: Fix input data copy when an error is captured
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 6 Jan 2020 10:37:00 +0000 (11:37 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 9 Jan 2020 16:40:55 +0000 (17:40 +0100)
commit8015ba0c4a9333967059bdf7c302f7a71e5ec5ea
tree15b5e42db6316986963a6df7f791157868069075
parente313c1bd5901b721bdfd23714c432235625a87a8
BUG/MINOR: proxy: Fix input data copy when an error is captured

In proxy_capture_error(), input data are copied in the error snapshot. The copy
must take care of the data wrapping. But the length of the first block is
wrong. It should be the amount of contiguous input data that can be copied
starting from the input's beginning. But the mininum between the input length
and the buffer size minus the input length is used instead. So it is a problem
if input data are wrapping or if more than the half of the buffer is used by
input data.

This patch must be backported as far as 1.9.

(cherry picked from commit 47a7210b9d377d91777f39241fab54d5f83b2728)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/proxy.c