From 1a33de617d06563a780af472cdfd910f6f21d450 Mon Sep 17 00:00:00 2001 From: ineed bots Date: Fri, 15 Dec 2023 12:40:46 -0600 Subject: [PATCH] Copy fix from cod2rev --- src/codsrc/clientscript/cscr_stringlist.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/codsrc/clientscript/cscr_stringlist.cpp b/src/codsrc/clientscript/cscr_stringlist.cpp index 115ac1d..17cbaf7 100644 --- a/src/codsrc/clientscript/cscr_stringlist.cpp +++ b/src/codsrc/clientscript/cscr_stringlist.cpp @@ -67,11 +67,18 @@ namespace codsrc { int len; - for ( len = refString->u.s.byteLen - 1; - refString->str[len]; - len += 256 ) + if (!refString->u.s.byteLen) { - ; + len = 256 - 1; //Bugfix for 256 % 256 = 0 or 512 % 256 = 0 or... Just promote it to 256 + } + else + { + len = refString->u.s.byteLen - 1; + } + + while (refString->str[len]) + { + len += 256; } return len;