aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.h
diff options
context:
space:
mode:
authoreugene <elzeigel@gmail.com>2021-05-11 11:21:29 -0400
committereugene <elzeigel@gmail.com>2021-05-11 11:21:29 -0400
commit9c891b64ffd14bc8216dbd5eb60816043af265b6 (patch)
treebeefec68583cc30cc5586d5e19eb3d5b913ac830 /src/protocol.h
parentf8176b768a1c1500ae64815960948eda415e9997 (diff)
downloadbitcoin-9c891b64ffd14bc8216dbd5eb60816043af265b6.tar.xz
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.
Diffstat (limited to 'src/protocol.h')
-rw-r--r--src/protocol.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/protocol.h b/src/protocol.h
index f183db0501..c73484bdf6 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -16,6 +16,7 @@
#include <uint256.h>
#include <version.h>
+#include <limits>
#include <stdint.h>
#include <string>
@@ -51,7 +52,7 @@ public:
char pchMessageStart[MESSAGE_START_SIZE];
char pchCommand[COMMAND_SIZE];
- uint32_t nMessageSize;
+ uint32_t nMessageSize{std::numeric_limits<uint32_t>::max()};
uint8_t pchChecksum[CHECKSUM_SIZE];
};