(svn r22955) -Fix: guard from reading outside the silly name list

This commit is contained in:
rubidium 2011-09-23 19:25:48 +00:00
parent f65a1bd847
commit 1f266ec977

View File

@ -1409,7 +1409,7 @@ static char *GetSpecialNameString(char *buff, int ind, StringParameters *args, c
{
switch (ind) {
case 1: // not used
return strecpy(buff, _silly_company_names[args->GetInt32() & 0xFFFF], last);
return strecpy(buff, _silly_company_names[min(args->GetInt32() & 0xFFFF, lengthof(_silly_company_names) - 1)], last);
case 2: // used for Foobar & Co company names
return GenAndCoName(buff, args->GetInt32(), last);