Don't check errno if ktls_read_record() returned 0.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 5 Mar 2020 19:26:06 +0000 (11:26 -0800)
committerMatt Caswell <matt@openssl.org>
Mon, 31 Aug 2020 08:34:19 +0000 (09:34 +0100)
errno is only valid if ktls_read_record() fails with a negative return
value.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12111)

ssl/record/ssl3_record.c

index 27167ba92fdc8bd54052986ebb3fdca859853759..634052d342f9c4cbf32b2cc10e51794b2aafe085 100644 (file)
@@ -213,7 +213,7 @@ int ssl3_get_record(SSL *s)
                                num_recs == 0 ? 1 : 0, &n);
             if (rret <= 0) {
 #ifndef OPENSSL_NO_KTLS
-                if (!BIO_get_ktls_recv(s->rbio))
+                if (!BIO_get_ktls_recv(s->rbio) || rret == 0)
                     return rret;     /* error or non-blocking */
                 switch (errno) {
                 case EBADMSG: