BUG/MEDIUM: htx: Be sure to have a buffer to perform a raw copy of a message
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 1 Feb 2022 17:11:50 +0000 (18:11 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 25 Feb 2022 12:17:13 +0000 (13:17 +0100)
commit3c69a3ee68c69cdbe145179bd66af7bfa5c797f8
treebbc576a493da34b265d2b38c3d15670f67abd409
parentabf078b15fd5c6c209e72f969a10b712f605c583
BUG/MEDIUM: htx: Be sure to have a buffer to perform a raw copy of a message

In htx_copy_msg(), if the destination buffer is empty, we perform a raw copy
of the message instead of a copy block per block. But we must be sure the
destianation buffer was really allocated. In other word, to perform a raw
copy, the HTX message must be empty _AND_ it must have some free space
available.

This function is only used to copy an HTTP reply (for instance, an error or
a redirect) in the buffer of the response channel. For now, we are sure the
buffer was allocated because it is a pre-requisite to call stream
analyzers. However, it may be a source of bug in future.

This patch may be backported as far as 2.3.

(cherry picked from commit dc523e3b89d8ff3b73eb7d3218cbf2907c94f6ae)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
include/haproxy/htx.h