Fix #57: garbled tag name in std log file output

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2022-08-12 14:30:19 +02:00
parent 6bc8525a8d
commit 9e9c1c884a

View File

@ -1932,15 +1932,15 @@ static int fmt3164(struct buf_msg *buffer, char *fmt, struct iovec *iov, size_t
} }
if (buffer->app_name) { if (buffer->app_name) {
char tag[33];
/* /*
* RFC3164, sec 4.1.3: "The TAG is a string of ABNF * RFC3164, sec 4.1.3: "The TAG is a string of ABNF
* alphanumeric characters that MUST NOT exceed 32 * alphanumeric characters that MUST NOT exceed 32
* characters." * characters."
*/ */
strlcpy(tag, buffer->app_name, sizeof(tag)); iov[i].iov_base = buffer->app_name;
pushiov(iov, i, tag); iov[i].iov_len = MIN(strlen(buffer->app_name), 32);
i++;
if (buffer->proc_id) { if (buffer->proc_id) {
pushiov(iov, i, "["); pushiov(iov, i, "[");
pushiov(iov, i, buffer->proc_id); pushiov(iov, i, buffer->proc_id);