Skip to content

Commit

Permalink
Merge #89: Avoid strlen; use strnlen
Browse files Browse the repository at this point in the history
a39d791 Avoid strlen; use strnlen (Pieter Wuille)

Pull request description:

Top commit has no ACKs.

Tree-SHA512: 4e60f2aece7e83635ea0db6adf623472649a05d4b69f3700cae4fb94e2e937503774a332d7bae794f59261d5fd62e3679db9cdd704c31e5350ffb5b9f1b6c51f
  • Loading branch information
sipa committed Jan 15, 2021
2 parents 0df0e52 + a39d791 commit a09d287
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a09d287

Please sign in to comment.