summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/strings.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index cf2f60348..ae72e2a25 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -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);