Avoid strlen; use strnlen
This commit is contained in:
parent
0df0e521f1
commit
a39d7916d0
1 changed files with 1 additions and 1 deletions
|
@ -36,7 +36,7 @@ CMessageHeader::CMessageHeader()
|
|||
CMessageHeader::CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn)
|
||||
{
|
||||
memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart));
|
||||
int command_len = strlen(pszCommand);
|
||||
size_t command_len = strnlen(pszCommand, COMMAND_SIZE);
|
||||
memcpy(pchCommand, pszCommand, command_len);
|
||||
memset(pchCommand + command_len, 0, COMMAND_SIZE - command_len);
|
||||
nMessageSize = nMessageSizeIn;
|
||||
|
|
Loading…
Reference in a new issue