Commit d969f862 authored by Mattias Jernberg's avatar Mattias Jernberg

Fix syslog output

payload does not appear to be reliably null terminated and leaks
data. Use size to the formatter to reliably terminate messages.
parent fd534722
......@@ -59,7 +59,8 @@ protected:
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 {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment