Fix the same (ancient!) bug in ipv4 code...

Don't read the address of the peer until we know we've actually read
a packet.
This commit is contained in:
Jeff Teunissen 2010-12-30 07:15:22 -05:00
parent e6b75600e8
commit 999252c07a

View file

@ -262,9 +262,6 @@ NET_GetPacket (void)
sizeof (net_message_buffer), 0, (struct sockaddr *) &from, sizeof (net_message_buffer), 0, (struct sockaddr *) &from,
&fromlen); &fromlen);
SockadrToNetadr (&from, &net_from);
if (ret == -1) { if (ret == -1) {
#ifdef _WIN32 #ifdef _WIN32
int err = WSAGetLastError (); int err = WSAGetLastError ();
@ -291,6 +288,8 @@ NET_GetPacket (void)
return false; return false;
} }
SockadrToNetadr (&from, &net_from);
// Check for malformed packets // Check for malformed packets
if (ntohs (net_from.port) < 1024) { if (ntohs (net_from.port) < 1024) {
Sys_Printf ("Warning: Packet from %s dropped: Bad port\n", Sys_Printf ("Warning: Packet from %s dropped: Bad port\n",