summaryrefslogtreecommitdiff
path: root/src/network/core/udp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/core/udp.cpp')
-rw-r--r--src/network/core/udp.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index 72fec49e1..614ae8c3b 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -134,14 +134,14 @@ void NetworkUDPSocketHandler::ReceivePackets()
#endif
NetworkAddress address(client_addr, client_len);
- p.PrepareToRead();
/* If the size does not match the packet must be corrupted.
* Otherwise it will be marked as corrupted later on. */
- if (nbytes != p.size) {
+ if (!p.ParsePacketSize() || nbytes != p.size) {
DEBUG(net, 1, "received a packet with mismatching size from %s", address.GetAddressAsString().c_str());
continue;
}
+ p.PrepareToRead();
/* Handle the packet */
this->HandleUDPPacket(&p, &address);