net: initialize nMessageSize to max uint32_t instead of -1
nMessageSize is uint32_t and is set to -1. This will warn with -fsanitize=implicit-integer-sign-change.
This commit is contained in:
1 parent
f8176b768a
commit
9c891b64ff
3 files changed
+2
-3
No files matched your search
@@ -91,7 +91,6 @@ CMessageHeader::CMessageHeader()
|
|||||||
{
|
{
|
||||||
memset(pchMessageStart, 0, MESSAGE_START_SIZE);
|
memset(pchMessageStart, 0, MESSAGE_START_SIZE);
|
||||||
memset(pchCommand, 0, sizeof(pchCommand));
|
memset(pchCommand, 0, sizeof(pchCommand));
|
||||||
nMessageSize = -1;
|
|
||||||
memset(pchChecksum, 0, CHECKSUM_SIZE);
|
memset(pchChecksum, 0, CHECKSUM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
#include <version.h>
|
#include <version.h>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ public:
|
|||||||
|
|
||||||
char pchMessageStart[MESSAGE_START_SIZE];
|
char pchMessageStart[MESSAGE_START_SIZE];
|
||||||
char pchCommand[COMMAND_SIZE];
|
char pchCommand[COMMAND_SIZE];
|
||||||
uint32_t nMessageSize;
|
uint32_t nMessageSize{std::numeric_limits<uint32_t>::max()};
|
||||||
uint8_t pchChecksum[CHECKSUM_SIZE];
|
uint8_t pchChecksum[CHECKSUM_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ implicit-integer-sign-change:key.cpp
|
|||||||
implicit-integer-sign-change:noui.cpp
|
implicit-integer-sign-change:noui.cpp
|
||||||
implicit-integer-sign-change:policy/fees.cpp
|
implicit-integer-sign-change:policy/fees.cpp
|
||||||
implicit-integer-sign-change:prevector.h
|
implicit-integer-sign-change:prevector.h
|
||||||
implicit-integer-sign-change:protocol.cpp
|
|
||||||
implicit-integer-sign-change:script/bitcoinconsensus.cpp
|
implicit-integer-sign-change:script/bitcoinconsensus.cpp
|
||||||
implicit-integer-sign-change:script/interpreter.cpp
|
implicit-integer-sign-change:script/interpreter.cpp
|
||||||
implicit-integer-sign-change:serialize.h
|
implicit-integer-sign-change:serialize.h
|
||||||
|
|||||||
Reference in new issue
Block a user