diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-08-08 05:40:44 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-08-08 05:40:47 +0200 |
commit | 57019d5f75ca4ce6e82161447ff3ed0745d8a77a (patch) | |
tree | 584cc014ad755035ca3fc760b03cf682116b66bf /src/journal/journald-syslog.c | |
parent | link: fix type for link-config's "features" array of tristates (diff) | |
download | systemd-57019d5f75ca4ce6e82161447ff3ed0745d8a77a.tar.xz systemd-57019d5f75ca4ce6e82161447ff3ed0745d8a77a.zip |
journal: do not pass a negative value to memcpy()
The message may contains only whitespaces.
Fixes #9795.
Diffstat (limited to '')
-rw-r--r-- | src/journal/journald-syslog.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 08b4fcb1c2..2de3bdf66f 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 { |