1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-31 02:19:09 +00:00

Fix #11644: Off by one error in StrMakeValid buffer last character

This commit is contained in:
Jonathan G Rennison
2023-12-29 22:31:33 +00:00
parent b62da66ba9
commit 0d762a2bc1

View File

@@ -211,8 +211,10 @@ void StrMakeValidInPlace(char *str, StringValidationSettings settings)
*/
std::string StrMakeValid(std::string_view str, StringValidationSettings settings)
{
if (str.empty()) return {};
auto buf = str.data();
auto last = buf + str.size();
auto last = buf + str.size() - 1;
std::ostringstream dst;
std::ostreambuf_iterator<char> dst_iter(dst);