Merge pull request #1140 from mattiasj-axis/fix-syslog-termination

Fix syslog output
This commit is contained in:
Gabi Melman 2019-07-08 14:25:54 +03:00 committed by GitHub
commit 2d8c4b1c88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,8 @@ protected:
payload = msg.payload; payload = msg.payload;
} }
::syslog(syslog_prio_from_level(msg), "%s", payload.data()); int length = std::min<std::common_type<int, std::size_t>::type>(std::numeric_limits<int>::max(), payload.size());
::syslog(syslog_prio_from_level(msg), "%.*s", length, payload.data());
} }
void flush_() override {} void flush_() override {}