diff options
author | rubidium <rubidium@openttd.org> | 2009-04-02 23:03:18 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-02 23:03:18 +0000 |
commit | beef5da970ba9571aa5673b53cad5edb8b065a2b (patch) | |
tree | c48bb41c564431e5f78a962caee1ffb3a41980f9 | |
parent | c5160c7c8e80b1b64bf474ec1d2a54c2bcef690b (diff) | |
download | openttd-beef5da970ba9571aa5673b53cad5edb8b065a2b.tar.xz |
(svn r15918) -Fix (r15917): comparing IPs sometimes failed due to 'random' data (as spotted by SpComb)
-rw-r--r-- | src/network/core/udp.cpp | 2 | ||||
-rw-r--r-- | src/network/network.cpp | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp index 31ae8a446..110cec2f2 100644 --- a/src/network/core/udp.cpp +++ b/src/network/core/udp.cpp @@ -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); diff --git a/src/network/network.cpp b/src/network/network.cpp index e88b7a1f8..ebd10980d 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -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; |