File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -660,13 +660,14 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)
660
660
{
661
661
// If the input is a command, check that it isn't the 'login' command, if it is censor it
662
662
char szInput[256 ];
663
- strncpy (szInput, m_strInputText. c_str () + 1 , 256 ) ;
663
+ unsigned int uiLength = sizeof (szInput) - 1 ;
664
664
665
- const char * szCommand;
666
- if (szInput[0 ])
667
- szCommand = strtok (szInput, " " );
665
+ strncpy (szInput, m_strInputText.c_str () + 1 , uiLength);
666
+ szInput[uiLength] = ' \0 ' ;
668
667
669
- if ((strcmp (szCommand, " login" ) != 0 ))
668
+ const char * szCommand = strtok (szInput, " " );
669
+
670
+ if (szCommand && (strcmp (szCommand, " login" ) != 0 ))
670
671
m_pInputHistory->Add (m_strInputText);
671
672
else if ((m_pInputHistory->Empty () || m_pInputHistory->GetLast () != std::string (" /login" )))
672
673
m_pInputHistory->Add (" /login" );
You can’t perform that action at this time.
0 commit comments