BUG/MEDIUM: bad length in log_format and __send_log
__send_log(): the size of the buffer sent is wrong when the facility
is lower than 3 digits.
logformat_write_string(): computation of size is wrong
Note: this was introduced after 1.5-dev7, no backport needed.
diff --git a/src/log.c b/src/log.c
index f095297..e016e33 100644
--- a/src/log.c
+++ b/src/log.c
@@ -506,7 +506,7 @@
return NULL;
}
dst += strlcpy2(dst, src, size);
- size -= orig - dst + 1;
+ size -= dst - orig + 1;
if (size > 1) {
*(dst++) = '"';
*dst = '\0';
@@ -672,7 +672,7 @@
} while (fac_level && log_ptr > dataptr);
*log_ptr = '<';
- sent = sendto(*plogfd, log_ptr, size,
+ sent = sendto(*plogfd, log_ptr, size + log_ptr - dataptr,
MSG_DONTWAIT | MSG_NOSIGNAL,
(struct sockaddr *)&logsrv->addr, get_addr_len(&logsrv->addr));
if (sent < 0) {