From edf27a8992e3b91decc47d0075c5eb2b62608333 Mon Sep 17 00:00:00 2001 From: EasyCoderWei <535345385@qq.com> Date: Wed, 22 Sep 2021 11:16:18 +0800 Subject: [PATCH] Fixbug: fd may be 0 when BIO_get_fd return 0 --- ssl/statem_ntls/statem_ntls.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ssl/statem_ntls/statem_ntls.c b/ssl/statem_ntls/statem_ntls.c index 430bb18df..80bf4d26c 100644 --- a/ssl/statem_ntls/statem_ntls.c +++ b/ssl/statem_ntls/statem_ntls.c @@ -264,14 +264,14 @@ int SSL_connection_is_ntls(SSL *s, int is_server) * have to get the server version from clientHello */ if (SSL_IS_FIRST_HANDSHAKE(s) && SSL_in_before(s)) { - int ret, fd; + int ret, fd = -1; PACKET pkt; unsigned int version, type; unsigned char buf[PEEK_HEADER_LENGTH]; - ret = BIO_get_fd(s->rbio, &fd); + (void) BIO_get_fd(s->rbio, &fd); - if (ret <= 0) { + if (fd < 0) { /* NTLS only support socket communication */ SSLfatal_ntls(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_CONNECTION_IS_NTLS, ERR_R_INTERNAL_ERROR);