Fix stack underflow

This commit is contained in:
def 2014-12-02 12:35:52 +01:00
parent db4d472443
commit d3837038eb

View file

@ -2524,6 +2524,7 @@ void CGameContext::SendChatResponseAll(const char *pLine, void *pUser)
CGameContext *pSelf = (CGameContext *)pUser; CGameContext *pSelf = (CGameContext *)pUser;
static volatile int ReentryGuard = 0; static volatile int ReentryGuard = 0;
const char *pLineOrig = pLine;
if(ReentryGuard) if(ReentryGuard)
return; return;
@ -2532,7 +2533,7 @@ void CGameContext::SendChatResponseAll(const char *pLine, void *pUser)
if(*pLine == '[') if(*pLine == '[')
do do
pLine++; pLine++;
while(*(pLine - 2) != ':' && *pLine != 0);//remove the category (e.g. [Console]: No Such Command) while((pLine - 2 < pLineOrig || *(pLine - 2) != ':') && *pLine != 0);//remove the category (e.g. [Console]: No Such Command)
pSelf->SendChat(-1, CHAT_ALL, pLine); pSelf->SendChat(-1, CHAT_ALL, pLine);
@ -2547,6 +2548,8 @@ void CGameContext::SendChatResponse(const char *pLine, void *pUser)
if(ClientID < 0 || ClientID >= MAX_CLIENTS) if(ClientID < 0 || ClientID >= MAX_CLIENTS)
return; return;
const char *pLineOrig = pLine;
static volatile int ReentryGuard = 0; static volatile int ReentryGuard = 0;
if(ReentryGuard) if(ReentryGuard)
@ -2556,7 +2559,7 @@ void CGameContext::SendChatResponse(const char *pLine, void *pUser)
if(*pLine == '[') if(*pLine == '[')
do do
pLine++; pLine++;
while(*(pLine - 2) != ':' && *pLine != 0); // remove the category (e.g. [Console]: No Such Command) while((pLine - 2 < pLineOrig || *(pLine - 2) != ':') && *pLine != 0); // remove the category (e.g. [Console]: No Such Command)
pSelf->SendChatTarget(ClientID, pLine); pSelf->SendChatTarget(ClientID, pLine);