journal: do not pass a negative value to memcpy()

The message may contains only whitespaces.

Fixes #9795.
This commit is contained in:
Yu Watanabe 2018-08-08 12:40:44 +09:00
parent cc2ff878fa
commit 57019d5f75
1 changed files with 4 additions and 1 deletions

View File

@ -333,7 +333,10 @@ void server_process_syslog_message(
leading_ws = strspn(buf, WHITESPACE);
if (i == raw_len)
if (i == 0)
/* The message contains only whitespaces */
msg = buf + raw_len;
else if (i == raw_len)
/* Nice! No need to strip anything on the end, let's optimize this a bit */
msg = buf + leading_ws;
else {