diff --git a/src/settings.cpp b/src/settings.cpp index 0576af3883..d238ec97cb 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -578,7 +578,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)); }