mirror of
https://github.com/openssl/openssl.git
synced 2024-12-17 22:13:45 +08:00
bio: check for valid socket when closing
Fixes coverity 271258 Improper use of negative value (NEGATIVE_RETURNS) Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15943)
This commit is contained in:
parent
01fb4bff9b
commit
196feb18de
@ -335,7 +335,7 @@ int BIO_accept_ex(int accept_sock, BIO_ADDR *addr_, int options)
|
||||
*/
|
||||
int BIO_closesocket(int sock)
|
||||
{
|
||||
if (closesocket(sock) < 0)
|
||||
if (sock < 0 || closesocket(sock) < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user