#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
|
||||
ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
||||
ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* const addr)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
|
@ -325,7 +325,9 @@ ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
|||
int err = getsockerror_winsock();
|
||||
delete socket;
|
||||
free(tmp);
|
||||
*addr = NULL;
|
||||
if (addr) {
|
||||
*addr = NULL;
|
||||
}
|
||||
if (err == WSAEWOULDBLOCK) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -339,7 +341,9 @@ ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
|
|||
close_winsock(fd);
|
||||
delete socket;
|
||||
free(tmp);
|
||||
*addr = NULL;
|
||||
if (addr) {
|
||||
*addr = NULL;
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue