# HG changeset patch # User rubidium # Date 1316805948 0 # Node ID 95e66c734b7d93cc03578c34bf8428f5d1eb8d9a # Parent 8c64bb6b941bd9c9107e0cc3ec4ada15e9e87385 (svn r22955) -Fix: guard from reading outside the silly name list diff --git a/src/strings.cpp b/src/strings.cpp --- 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);