#6037 socket accept() failure could lead to NULL ptr dereference
This commit is contained in:
parent
1c5e986dcf
commit
485540bbb4
|
@ -311,7 +311,7 @@ ArchNetworkWinsock::listenOnSocket(ArchSocket s)
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchSocket
|
ArchSocket
|
||||||
ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* const addr)
|
||||||
{
|
{
|
||||||
assert(s != NULL);
|
assert(s != NULL);
|
||||||
|
|
||||||
|
@ -325,7 +325,9 @@ ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
||||||
int err = getsockerror_winsock();
|
int err = getsockerror_winsock();
|
||||||
delete socket;
|
delete socket;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
*addr = NULL;
|
if (addr) {
|
||||||
|
*addr = NULL;
|
||||||
|
}
|
||||||
if (err == WSAEWOULDBLOCK) {
|
if (err == WSAEWOULDBLOCK) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -339,7 +341,9 @@ ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
||||||
close_winsock(fd);
|
close_winsock(fd);
|
||||||
delete socket;
|
delete socket;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
*addr = NULL;
|
if (addr) {
|
||||||
|
*addr = NULL;
|
||||||
|
}
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue