Skip to content

Commit

Permalink
Merge pull request ddnet#9125 from KebsCS/pr-command-argument-validation
Browse files Browse the repository at this point in the history
Fix color validation in some commands
  • Loading branch information
def- authored Oct 7, 2024
2 parents 10df82a + 6d7aeab commit 46abb54
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/engine/shared/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,15 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientId, bo

if(Stroke || IsStrokeCommand)
{
if(int Error = ParseArgs(&Result, pCommand->m_pParams, pCommand->m_pfnCallback == &SColorConfigVariable::CommandCallback))
bool IsColor = false;
{
FCommandCallback pfnCallback = pCommand->m_pfnCallback;
void *pUserData = pCommand->m_pUserData;
TraverseChain(&pfnCallback, &pUserData);
IsColor = pfnCallback == &SColorConfigVariable::CommandCallback;
}

if(int Error = ParseArgs(&Result, pCommand->m_pParams, IsColor))
{
char aBuf[CMDLINE_LENGTH + 64];
if(Error == PARSEARGS_INVALID_INTEGER)
Expand Down

0 comments on commit 46abb54

Please sign in to comment.