]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - net_udp.c
apply the 0 byte udp packet DoS fix from nuq.
[xonotic/darkplaces.git] / net_udp.c
index ae384e1775056b029af412da6f193b970d3263fc..d98ed0ff3f914bc7fc4c4a8dea80516b739e694a 100644 (file)
--- 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;
 }