diff --git a/include/boost/static_string/detail/static_string.hpp b/include/boost/static_string/detail/static_string.hpp index 88386de..0888a91 100644 --- a/include/boost/static_string/detail/static_string.hpp +++ b/include/boost/static_string/detail/static_string.hpp @@ -405,7 +405,7 @@ inline static_string to_static_string_float_impl(Floating value) { - char buffer[N]; + char buffer[N + 1]; std::sprintf(buffer, "%f", value); return static_string(buffer); } @@ -415,8 +415,8 @@ inline static_wstring to_static_wstring_float_impl(Floating value) { - wchar_t buffer[N]; - std::swprintf(buffer, L"%f", value); + wchar_t buffer[N + 1]; + std::swprintf(buffer, N + 1, L"%f", value); return static_wstring(buffer); }