diff --git a/include/spdlog/sinks/syslog_sink.h b/include/spdlog/sinks/syslog_sink.h index ccc70693..a160c10d 100644 --- a/include/spdlog/sinks/syslog_sink.h +++ b/include/spdlog/sinks/syslog_sink.h @@ -59,8 +59,14 @@ protected: payload = msg.payload; } - int length = std::min::type>(std::numeric_limits::max(), payload.size()); - ::syslog(syslog_prio_from_level(msg), "%.*s", length, payload.data()); + size_t length = payload.size(); + // limit to max int + if(length > std::numeric_limits::max()) + { + length = std::numeric_limits::max(); + } + + ::syslog(syslog_prio_from_level(msg), "%.*s", static_cast(length), payload.data()); } void flush_() override {}