Mercurial > hg > openttd
changeset 18130:95e66c734b7d draft
(svn r22955) -Fix: guard from reading outside the silly name list
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 23 Sep 2011 19:25:48 +0000 |
parents | 8c64bb6b941b |
children | 07ea0c5b88b8 |
files | src/strings.cpp |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/strings.cpp +++ b/src/strings.cpp @@ -1409,7 +1409,7 @@ { 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);