From: taniwha Date: Thu, 30 Nov 2000 17:07:00 +0000 (+0000) Subject: apply the 0 byte udp packet DoS fix from nuq. X-Git-Tag: RELEASE_0_2_0_RC1~902 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1ccfccbc675a0ad179ab39bff6a021d14695af40;p=xonotic%2Fdarkplaces.git apply the 0 byte udp packet DoS fix from nuq. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@118 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/net_udp.c b/net_udp.c index ae384e17..d98ed0ff 100644 --- a/net_udp.c +++ b/net_udp.c @@ -229,6 +229,9 @@ int UDP_Connect (int socket, struct qsockaddr *addr) int UDP_CheckNewConnections (void) { unsigned long available; + struct sockaddr_in from; + socklen_t fromlen; + char buff[1]; if (net_acceptsocket == -1) return -1; @@ -237,6 +240,7 @@ int UDP_CheckNewConnections (void) Sys_Error ("UDP: ioctlsocket (FIONREAD) failed\n"); if (available) return net_acceptsocket; + recvfrom (net_acceptsocket, buff, 0, 0, &from, &fromlen); return -1; } diff --git a/net_wins.c b/net_wins.c index 0d5265ed..87a75eed 100644 --- a/net_wins.c +++ b/net_wins.c @@ -385,7 +385,7 @@ int WINS_CheckNewConnections (void) if (net_acceptsocket == -1) return -1; - if (precvfrom (net_acceptsocket, buf, sizeof(buf), MSG_PEEK, NULL, NULL) > 0) + if (precvfrom (net_acceptsocket, buf, sizeof(buf), MSG_PEEK, NULL, NULL) >= 0) { return net_acceptsocket; }