From 390c51f4fa1715bed4fd9b7db4cff9cc2e3d58c7 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 31 Jan 2019 04:44:59 +0100 Subject: [PATCH] Use consts instead of hardcoded values --- Source/multi.cpp | 4 ++-- Source/nthread.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/multi.cpp b/Source/multi.cpp index 0877d8445..4f76a6657 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -460,8 +460,8 @@ void __cdecl multi_process_network_packets() multi_clear_left_tbl(); v1 = pkt; v2 = pkt; - if ((unsigned int)len >= 0x13 - && *(_DWORD *)arglist < 4u + if ((unsigned int)len >= sizeof(TPktHdr) + && *(_DWORD *)arglist < MAX_PLRS && pkt->wCheck == 'ip' && (unsigned short)pkt->wLen == len) { v3 = *(_DWORD *)arglist; diff --git a/Source/nthread.cpp b/Source/nthread.cpp index f1b27b181..f57001644 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -116,7 +116,7 @@ int __fastcall nthread_recv_turns(int *pfSendAsync) sgbPacketCountdown = byte_679704; if (!hasCountedDown) goto LABEL_11; - if (SNetReceiveTurns(0, 4, (char **)glpMsgTbl, (unsigned int *)gdwMsgLenTbl, (LPDWORD)player_state)) { + if (SNetReceiveTurns(0, MAX_PLRS, (char **)glpMsgTbl, (unsigned int *)gdwMsgLenTbl, (LPDWORD)player_state)) { if (!byte_679758) { byte_679758 = 1; last_tick = GetTickCount();