]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: lua: breaks the log message if his size exceed one buffer
authorThierry FOURNIER <tfournier@arpalert.org>
Wed, 16 Sep 2015 10:47:03 +0000 (12:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 17 Sep 2015 15:51:51 +0000 (17:51 +0200)
Previously, the log was ignored if the log message exceed one buffer.
This patch doens't ignore the log, but trancate the message.

src/hlua.c

index 07e92631cdd28a0ddc62779a08afe1bd9798f5d8..9651b7fdb6115264e7c70e342538b04676222ffc 100644 (file)
@@ -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