BUG/MEDIUM: peers: fix decoding of multi-byte length in stick-table messages
There is a bug in peer_recv_msg() due to an incorrect cast when trying
to decode the varint length of a stick-table message, causing lengths
comprised between 128 and 255 to consume one extra byte, ending in
protocol errors. The root cause of this is that peer_recv_msg() tries
hard to reimplement all the parsing and control that is already done in
intdecode() just to measure the length before calling it. And it got it
wrong.
Let's just get rid of this unneeded code duplication and solely rely on
intdecode() instead. The bug was introduced in 2.0 as part of a cleanup
pass on this code with commit 95203f218 ("MINOR: peers: Move high level
receive code to reduce the size of I/O handler."), so this patch must
be backported to 2.0.
Thanks to Yves Lafon for reporting the problem.
(cherry picked from commit 1dfd4f106f15bc4e6e992f8babbc863c12975b5a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit d4913917c6e471b1d18c0574711768b3b47ea151)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 13bd9d4ef093df43e74d44f14a24f0ad25b170d8)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit c3983501586f5dc349d563e6ea906e5e23f69d95)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed