summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-06-29 08:01:13 +1000
committerPauli <pauli@openssl.org>2021-06-30 13:55:09 +1000
commit196feb18de28cc5e6b59483ab61453dbca8d5c4b (patch)
tree83990b9065e211d5233172081044e520c6c810f9 /crypto/bio
parent01fb4bff9bee4b6a652d42ec9f1b677773280450 (diff)
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)
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/bio_sock2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/bio/bio_sock2.c b/crypto/bio/bio_sock2.c
index f13f20148b..b6c95913ce 100644
--- a/crypto/bio/bio_sock2.c
+++ b/crypto/bio/bio_sock2.c
@@ -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;
}