From 25ab17585efa37739da61c8ffc663b1954a653c4 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 15 Feb 2012 20:56:29 +0100 Subject: [PATCH] Bugfix: do not create CAddress for invalid accepts --- src/net.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/net.cpp b/src/net.cpp index 63829d0e..a66b1a61 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -740,13 +740,17 @@ void ThreadSocketHandler2(void* parg) struct sockaddr_in sockaddr; socklen_t len = sizeof(sockaddr); SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len); - CAddress addr(sockaddr); + CAddress addr; int nInbound = 0; + if (hSocket != INVALID_SOCKET) + addr = CAddress(sockaddr); + CRITICAL_BLOCK(cs_vNodes) BOOST_FOREACH(CNode* pnode, vNodes) if (pnode->fInbound) nInbound++; + if (hSocket == INVALID_SOCKET) { if (WSAGetLastError() != WSAEWOULDBLOCK)