Fixed bug in CCommand constructor that could append junk to the command string

* Missed copying the null terminator
* Since m_pArgSBuffer is not initialized this problem can occur when the (command string buffer length) + 1 char in m_pArgSBuffer array happens to be non-zero.
This commit is contained in:
Travis Wehrman 2017-09-10 19:15:41 -05:00
parent 0d8dceea43
commit 208068486d

View File

@ -359,7 +359,7 @@ CCommand::CCommand( int nArgC, const char **ppArgV )
{ {
*pSBuf++ = '\"'; *pSBuf++ = '\"';
} }
memcpy( pSBuf, ppArgV[i], nLen ); memcpy( pSBuf, ppArgV[i], nLen+1 );
pSBuf += nLen; pSBuf += nLen;
if ( bContainsSpace ) if ( bContainsSpace )
{ {