Fix assert when buffer->hostname == NULL at startup

Default to use 'from' in RFC3164 parser, just like the RFC5424 parser
already does.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-11-08 15:50:09 +01:00
parent 0435139ec9
commit dd5b470342

View File

@ -1100,6 +1100,9 @@ parsemsg_rfc3164(const char *from, int pri, char *msg)
return; return;
} }
if (buffer.hostname == NULL || !RemoteHostname)
buffer.hostname = (char *)from;
/* Remove the TAG, if present. */ /* Remove the TAG, if present. */
parsemsg_rfc3164_app_name_procid(&msg, &buffer.app_name, &buffer.proc_id); parsemsg_rfc3164_app_name_procid(&msg, &buffer.app_name, &buffer.proc_id);
parsemsg_remove_unsafe_characters(msg, line, sizeof(line)); parsemsg_remove_unsafe_characters(msg, line, sizeof(line));