mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-12 17:19:09 +00:00
Fix #11644: Off by one error in StrMakeValid UTF-8 decode overrun detection
This commit is contained in:
@@ -141,7 +141,7 @@ static void StrMakeValid(T &dst, const char *str, const char *last, StringValida
|
||||
* would also reach the "last" byte of the string and a normal '\0'
|
||||
* termination will be placed after it.
|
||||
*/
|
||||
if (len == 0 || str + len > last || len != Utf8Decode(&c, str)) {
|
||||
if (len == 0 || str + len > last + 1 || len != Utf8Decode(&c, str)) {
|
||||
/* Maybe the next byte is still a valid character? */
|
||||
str++;
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user