From: Thierry FOURNIER Date: Wed, 16 Sep 2015 10:47:03 +0000 (+0200) Subject: BUG/MINOR: lua: breaks the log message if his size exceed one buffer X-Git-Tag: v1.6-dev6~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ccf0063896ff4c64ae9399d3a935660460e57731;p=thirdparty%2Fhaproxy.git BUG/MINOR: lua: breaks the log message if his size exceed one buffer Previously, the log was ignored if the log message exceed one buffer. This patch doens't ignore the log, but trancate the message. --- diff --git a/src/hlua.c b/src/hlua.c index 07e92631cd..9651b7fdb6 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -814,8 +814,14 @@ static inline void hlua_sendlog(struct proxy *px, int level, const char *msg) /* Cleanup the log message. */ p = trash.str; for (; *msg != '\0'; msg++, p++) { - if (p >= trash.str + trash.size - 1) - return; + if (p >= trash.str + trash.size - 1) { + /* Break the message if exceed the buffer size. */ + *(p-4) = ' '; + *(p-3) = '.'; + *(p-2) = '.'; + *(p-1) = '.'; + break; + } if (isprint(*msg)) *p = *msg; else