Merge #89: Avoid strlen; use strnlen
a39d7916d0
Avoid strlen; use strnlen (Pieter Wuille)
Pull request description:
Top commit has no ACKs.
Tree-SHA512: 4e60f2aece7e83635ea0db6adf623472649a05d4b69f3700cae4fb94e2e937503774a332d7bae794f59261d5fd62e3679db9cdd704c31e5350ffb5b9f1b6c51f
This commit is contained in:
commit
a09d2870d1
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