1
0
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:
pasky
2004-11-22 21:41:25 +00:00
parent d4b723a7c9
commit 3ee0dee12a
4 changed files with 7 additions and 3 deletions

View File

@@ -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;
}