From dedeccc3a4550f840ea6d2864ef419f149714b3c Mon Sep 17 00:00:00 2001 From: Rubidium Date: Mon, 2 Sep 2024 21:23:39 +0200 Subject: [PATCH] Fix 208952f: incorrect truncation in string setting validation (cherry picked from commit f2a8e18792e1f2cd7b6900773f70211f4f424cf3) --- src/settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings.cpp b/src/settings.cpp index 0bfb300f7a..577d9ecf38 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -690,7 +690,7 @@ void StringSettingDesc::MakeValueValid(std::string &str) const /* In case a maximum length is imposed by the setting, the length * includes the '\0' termination for network transfer purposes. * Also ensure the string is valid after chopping of some bytes. */ - std::string stdstr(str, this->max_length - 1); + std::string stdstr(str, 0, this->max_length - 1); str.assign(StrMakeValid(stdstr, SVS_NONE)); }