mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-12 09:09:09 +00:00
(svn r767) Introduce USERSTRING_LEN (128) and try to make sure we don't overflow it anywhere (as long as we keep USERSTRING_LEN above 7 or so).
This commit is contained in:
3
engine.c
3
engine.c
@@ -601,7 +601,8 @@ StringID GetCustomEngineName(int engine)
|
||||
{
|
||||
if (!_engine_custom_names[engine])
|
||||
return _engine_name_strings[engine];
|
||||
strcpy(_userstring, _engine_custom_names[engine]);
|
||||
strncpy(_userstring, _engine_custom_names[engine], USERSTRING_LEN);
|
||||
_userstring[USERSTRING_LEN - 1] = '\0';
|
||||
return STR_SPEC_USERSTRING;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user