mirror of https://github.com/OpenTTD/OpenTTD
Fix: when a string consumes more parameters than allowed, nullptr is attempted to be formatted
parent
f1ec2f274c
commit
1146904d45
|
@ -1074,7 +1074,9 @@ static void FormatString(StringBuilder &builder, const char *str_arg, StringPara
|
|||
|
||||
case SCC_RAW_STRING_POINTER: { // {RAW_STRING}
|
||||
const char *raw_string = (const char *)(size_t)args->GetInt64(SCC_RAW_STRING_POINTER);
|
||||
if (game_script && std::find(_game_script_raw_strings.begin(), _game_script_raw_strings.end(), raw_string) == _game_script_raw_strings.end()) {
|
||||
/* raw_string can be(come) nullptr when the parameter is out of range and 0 is returned instead. */
|
||||
if (raw_string == nullptr ||
|
||||
(game_script && std::find(_game_script_raw_strings.begin(), _game_script_raw_strings.end(), raw_string) == _game_script_raw_strings.end())) {
|
||||
builder += "(invalid RAW_STRING parameter)";
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue