0c89d2dcdbdfef935512f92054196e9dd61f673e
[openwrt-packages.git] /
1 commit ebc65295f5ab943955ea6ae9772932c32e39d02c
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date:   Wed Apr 10 14:21:51 2019 +0200
4
5     BUG/MEDIUM: spoe: Return an error if nothing is encoded for fragmented messages
6     
7     If the maximum frame size is very small with a large message or argument name,
8     it is possible to be unable to encode anything. In such case, it is important to
9     stop processing returning an error otherwise we will retry in loop to encode the
10     message, failing each time because of the too small frame size.
11     
12     This patch must be backported to 1.9 and 1.8.
13     
14     (cherry picked from commit a715ea82eacf4ccf7f447bf4dd4111cc29fe171e)
15     Signed-off-by: William Lallemand <wlallemand@haproxy.org>
16     (cherry picked from commit 3c76e4d79669329ae972f3348e441fea7316813f)
17     [cf: Adapted to use old buffer API]
18     Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
19
20 diff --git a/src/flt_spoe.c b/src/flt_spoe.c
21 index 64601e3f..95f30898 100644
22 --- a/src/flt_spoe.c
23 +++ b/src/flt_spoe.c
24 @@ -2276,7 +2276,9 @@ spoe_encode_messages(struct stream *s, struct spoe_context *ctx,
25         return 1;
26  
27    too_big:
28 -       if (!(agent->flags & SPOE_FL_SND_FRAGMENTATION)) {
29 +       /* Return an error if fragmentation is unsupported or if nothing has
30 +        * been encoded because its too big and not splittable. */
31 +       if (!(agent->flags & SPOE_FL_SND_FRAGMENTATION) || p == ctx->buffer->p) {
32                 ctx->status_code = SPOE_CTX_ERR_TOO_BIG;
33                 return -1;
34         }
git clone https://git.99rst.org/PROJECT