From 71e3562f760183497e5d484f7f7bd0ac4fa581ec Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 11 Dec 2010 13:34:23 +0000 Subject: (svn r21463) -Fix [FS#4296] (r21405): when packets are filled their pos and size aren't the same as when they're read. As a check was incorrect. --- src/network/network_udp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/network') diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp index 0711ecbcd..7ed8cae8a 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -144,15 +144,15 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO) static const uint MIN_CI_SIZE = 54; uint max_cname_length = NETWORK_COMPANY_NAME_LENGTH; - if (Company::GetNumItems() * (MIN_CI_SIZE + NETWORK_COMPANY_NAME_LENGTH) >= (uint)packet.size - packet.pos) { + if (Company::GetNumItems() * (MIN_CI_SIZE + NETWORK_COMPANY_NAME_LENGTH) >= (uint)SEND_MTU - packet.size) { /* Assume we can at least put the company information in the packets. */ - assert(Company::GetNumItems() * MIN_CI_SIZE < (uint)packet.size - packet.pos); + assert(Company::GetNumItems() * MIN_CI_SIZE < (uint)SEND_MTU - packet.size); /* At this moment the company names might not fit in the * packet. Check whether that is really the case. */ for (;;) { - int free = packet.size - packet.pos; + int free = SEND_MTU - packet.size; Company *company; FOR_ALL_COMPANIES(company) { char company_name[NETWORK_COMPANY_NAME_LENGTH]; -- cgit v1.2.3-70-g09d2