chiark / gitweb /
log: Print truncated messages
[secnet.git] / log.c
diff --git a/log.c b/log.c
index 4f1b651d13735af9d899ff9988979fd87209fdb5..9cd0572bdebffe76f4c0522e839db4591026cb4f 100644 (file)
--- a/log.c
+++ b/log.c
@@ -38,6 +38,8 @@ static void vMessage(uint32_t class, const char *message, va_list args)
        bp=strlen(buff);
        assert(bp < MESSAGE_BUFLEN);
        vsnprintf(buff+bp,MESSAGE_BUFLEN-bp,message,args);
+       buff[sizeof(buff)-2] = '\n';
+       buff[sizeof(buff)-1] = '\0';
        /* Each line is sent separately */
        while ((nlp=strchr(buff,'\n'))) {
            *nlp=0;