diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-22 11:47:02 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-24 09:12:43 +1000 |
commit | 5a14bd153a9c725c3b7b1e02920dc36052320b5b (patch) | |
tree | 869d6b311384eef260dc1654146a5ec8c1b8da83 /apps | |
parent | a60b533125c9316a8433b67ad8858d936fe2a426 (diff) |
apps: fix coverity 271258: improper use of negative value
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14638)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/s_time.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/s_time.c b/apps/s_time.c index 386a81a78e..60861642f5 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -127,7 +127,7 @@ int s_time_main(int argc, char **argv) int maxtime = SECONDS, nConn = 0, perform = 3, ret = 1, i, st_bugs = 0; long bytes_read = 0, finishtime = 0; OPTION_CHOICE o; - int min_version = 0, max_version = 0, ver, buf_len; + int min_version = 0, max_version = 0, ver, buf_len, fd; size_t buf_size; meth = TLS_client_method(); @@ -346,7 +346,8 @@ int s_time_main(int argc, char **argv) continue; } SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); - BIO_closesocket(SSL_get_fd(scon)); + if ((fd = SSL_get_fd(scon)) >= 0) + BIO_closesocket(fd); nConn = 0; totalTime = 0.0; @@ -373,7 +374,8 @@ int s_time_main(int argc, char **argv) bytes_read += i; } SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); - BIO_closesocket(SSL_get_fd(scon)); + if ((fd = SSL_get_fd(scon)) >= 0) + BIO_closesocket(fd); nConn += 1; if (SSL_session_reused(scon)) { |