mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Fix 208952f
: incorrect truncation in string setting validation
(cherry picked from commit f2a8e18792
)
This commit is contained in:
parent
63c0443cee
commit
dedeccc3a4
@ -690,7 +690,7 @@ void StringSettingDesc::MakeValueValid(std::string &str) const
|
|||||||
/* In case a maximum length is imposed by the setting, the length
|
/* In case a maximum length is imposed by the setting, the length
|
||||||
* includes the '\0' termination for network transfer purposes.
|
* includes the '\0' termination for network transfer purposes.
|
||||||
* Also ensure the string is valid after chopping of some bytes. */
|
* 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));
|
str.assign(StrMakeValid(stdstr, SVS_NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user