From 999252c07a5fe68b35f89eec3a7a42eee743b33f Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Thu, 30 Dec 2010 07:15:22 -0500 Subject: [PATCH] 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. --- libs/net/nc/net_udp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/net/nc/net_udp.c b/libs/net/nc/net_udp.c index 709dea9a5..f91786ead 100644 --- a/libs/net/nc/net_udp.c +++ b/libs/net/nc/net_udp.c @@ -262,9 +262,6 @@ NET_GetPacket (void) sizeof (net_message_buffer), 0, (struct sockaddr *) &from, &fromlen); - SockadrToNetadr (&from, &net_from); - - if (ret == -1) { #ifdef _WIN32 int err = WSAGetLastError (); @@ -291,6 +288,8 @@ NET_GetPacket (void) return false; } + SockadrToNetadr (&from, &net_from); + // Check for malformed packets if (ntohs (net_from.port) < 1024) { Sys_Printf ("Warning: Packet from %s dropped: Bad port\n",