syslogd: ensure tag is <= 32 chars for RFC3164 output
This may cause a bit of a regression for some users, but the RFC is crystal clear on this point, the tag MUST NOT exceed 32 characters. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
parent
3969dbb8a6
commit
50f6ad74cb
@ -1930,7 +1930,15 @@ static int fmt3164(struct buf_msg *buffer, char *fmt, struct iovec *iov, size_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (buffer->app_name) {
|
if (buffer->app_name) {
|
||||||
pushiov(iov, i, buffer->app_name);
|
char tag[33];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RFC3164, sec 4.1.3: "The TAG is a string of ABNF
|
||||||
|
* alphanumeric characters that MUST NOT exceed 32
|
||||||
|
* characters."
|
||||||
|
*/
|
||||||
|
strlcpy(tag, buffer->app_name, sizeof(tag));
|
||||||
|
pushiov(iov, i, tag);
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user