From 43565e4363f9ece90dd332dbb96f9ba65c68e0ea Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 28 Jan 2022 10:47:52 +0000 Subject: [PATCH] Increase QEx strings limit, for mods that use fancy writebyte hacks. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6170 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_parse.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 56e7fb529..1cbfb2315 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -4107,18 +4107,21 @@ static void CLQEX_ParseServerVars(void) static char *CLQEX_ReadStrings(void) { unsigned short count = MSG_ReadShort(), a; - const char *arg[8]; + const char *arg[256]; static char formatted[8192]; - if (count > countof(arg)) - Host_EndGame ("CLQEX_ReadStrings: too many strings (%u>%u)", count, (unsigned)countof(arg)); - for (a = 0; a < count; a++) + char inputs[65536]; + size_t ofs = 0; + for (a = 0; a < count && a < countof(arg); ) { - char *s = alloca(8192); - arg[a] = s; - MSG_ReadStringBuffer(s, 8192); + arg[a++] = MSG_ReadStringBuffer(inputs+ofs, sizeof(inputs)-1); + ofs += strlen(inputs+ofs)+1; + if (ofs >= sizeof(inputs)) + break; } + for (; a < count; a++) + MSG_ReadString(); //don't lose space, though we can't buffer it. - TL_Reformat(formatted, sizeof(formatted), count, arg); + TL_Reformat(formatted, sizeof(formatted), a, arg); return formatted; }