mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Translations: prevent remote crash with invalid translations
This commit is contained in:
parent
d3f1743fdd
commit
6761e21383
1 changed files with 6 additions and 1 deletions
|
@ -866,7 +866,12 @@ void translate_string(const std::wstring &s, const std::wstring &textdomain,
|
||||||
// Here we have an argument; get its index and add the translated argument to the output.
|
// Here we have an argument; get its index and add the translated argument to the output.
|
||||||
int arg_index = toutput[j] - L'1';
|
int arg_index = toutput[j] - L'1';
|
||||||
++j;
|
++j;
|
||||||
|
if (0 <= arg_index && (size_t)arg_index < args.size()) {
|
||||||
result << args[arg_index];
|
result << args[arg_index];
|
||||||
|
} else {
|
||||||
|
// This is not allowed: show an error message
|
||||||
|
errorstream << "Ignoring out-of-bounds argument escape sequence in translation" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res = result.str();
|
res = result.str();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue