From: Yu Watanabe Date: Wed, 8 Aug 2018 03:40:44 +0000 (+0900) Subject: journal: do not pass a negative value to memcpy() X-Git-Tag: v240~846^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=57019d5f75ca4ce6e82161447ff3ed0745d8a77a;p=thirdparty%2Fsystemd.git journal: do not pass a negative value to memcpy() The message may contains only whitespaces. Fixes #9795. --- diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 08b4fcb1c2d..2de3bdf66f0 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -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 {