From 1f266ec97735ab7d917f6161cbe14420cd9affd2 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 23 Sep 2011 19:25:48 +0000 Subject: (svn r22955) -Fix: guard from reading outside the silly name list --- src/strings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3-54-g00ecf