Skip to content

Commit 5ec4db2

Browse files
laanwjFuzzbawls
authored andcommitted
net: Hardcode protocol sizes and use fixed-size types
The P2P network uses a fixed protocol, these sizes shouldn't change based on what happens to be the architecture.
1 parent de87ea6 commit 5ec4db2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/protocol.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ class CMessageHeader
5454
public:
5555
enum {
5656
COMMAND_SIZE = 12,
57-
MESSAGE_SIZE_SIZE = sizeof(int),
58-
CHECKSUM_SIZE = sizeof(int),
57+
MESSAGE_SIZE_SIZE = 4,
58+
CHECKSUM_SIZE = 4,
5959

6060
MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE,
6161
CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE,
6262
HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE
6363
};
6464
char pchMessageStart[MESSAGE_START_SIZE];
6565
char pchCommand[COMMAND_SIZE];
66-
unsigned int nMessageSize;
66+
uint32_t nMessageSize;
6767
uint8_t pchChecksum[CHECKSUM_SIZE];
6868
};
6969

0 commit comments

Comments
 (0)