(svn r15918) -Fix (r15917): comparing IPs sometimes failed due to 'random' data (as spotted by SpComb)

This commit is contained in:
rubidium 2009-04-02 23:03:18 +00:00
parent c5160c7c8e
commit beef5da970
2 changed files with 3 additions and 0 deletions

View File

@ -101,6 +101,8 @@ void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv)
void NetworkUDPSocketHandler::ReceivePackets()
{
struct sockaddr_storage client_addr;
memset(&client_addr, 0, sizeof(client_addr));
socklen_t client_len;
int nbytes;
Packet p(this);

View File

@ -480,6 +480,7 @@ static void NetworkAcceptClients()
assert(_listensocket != INVALID_SOCKET);
for (;;) {
memset(&sin, 0, sizeof(sin));
socklen_t sin_len = sizeof(sin);
SOCKET s = accept(_listensocket, (struct sockaddr*)&sin, &sin_len);
if (s == INVALID_SOCKET) return;