From: Christopher Faulet Date: Wed, 10 Apr 2019 12:21:51 +0000 (+0200) Subject: BUG/MEDIUM: spoe: Return an error if nothing is encoded for fragmented messages X-Git-Tag: v2.0-dev3~312 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a715ea82eacf4ccf7f447bf4dd4111cc29fe171e;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: spoe: Return an error if nothing is encoded for fragmented messages If the maximum frame size is very small with a large message or argument name, it is possible to be unable to encode anything. In such case, it is important to stop processing returning an error otherwise we will retry in loop to encode the message, failing each time because of the too small frame size. This patch must be backported to 1.9 and 1.8. --- diff --git a/src/flt_spoe.c b/src/flt_spoe.c index a7d6bb9506..703d6ba96d 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -2287,7 +2287,9 @@ spoe_encode_messages(struct stream *s, struct spoe_context *ctx, return 1; too_big: - if (!(agent->flags & SPOE_FL_SND_FRAGMENTATION)) { + /* Return an error if fragmentation is unsupported or if nothing has + * been encoded because its too big and not splittable. */ + if (!(agent->flags & SPOE_FL_SND_FRAGMENTATION) || p == b_head(&ctx->buffer)) { ctx->status_code = SPOE_CTX_ERR_TOO_BIG; return -1; }