From: Aurelien DARRAGON Date: Tue, 27 Jun 2023 09:32:06 +0000 (+0200) Subject: BUG/MINOR: log: LF upsets maxlen for UDP targets X-Git-Tag: v2.9-dev2~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=901f31bc9a97b972d8e36362c6f4659f42532194;p=thirdparty%2Fhaproxy.git BUG/MINOR: log: LF upsets maxlen for UDP targets A regression was introduced with 5464885 ("MEDIUM: log/sink: re-work and merge of build message API."). For UDP targets, a final '\n' is systematically inserted, but with the rework of the build message API, it is inserted after the maxlen limitation has been enforced, so this can lead to the final message becoming maxlen+1. For strict syslog servers that only accept up to maxlen characters, this could be a problem. To fix the regression, we take the final '\n' into account prior to building the message, like it was done before the rework of the API. This should be backported up to 2.4. --- diff --git a/src/log.c b/src/log.c index 95a4b63817..916212ee7e 100644 --- a/src/log.c +++ b/src/log.c @@ -1701,7 +1701,7 @@ static inline void __do_send_log(struct logsrv *logsrv, int nblogger, int level, } else { int i = 0; - int totlen = logsrv->maxlen; + int totlen = logsrv->maxlen - 1; /* save space for the final '\n' */ for (i = 0 ; i < nbelem ; i++ ) { iovec[i].iov_base = msg_header[i].ptr;