]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix ssl3_do_write() to correctly handle retries
authorMatt Caswell <matt@openssl.org>
Wed, 12 Jul 2023 14:50:25 +0000 (15:50 +0100)
committerPauli <pauli@openssl.org>
Sun, 16 Jul 2023 23:39:46 +0000 (09:39 +1000)
A BIO is documented to return -1 on write retry - but sometimes they return
0. ssl3_do_write() was incorrectly handling a 0 response.

Fixes #21422

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21434)

ssl/statem/statem_lib.c

index 635e84a764cee5504cb1fc42113a9d8c21bd8d45..406788bbfc10fbc185ae91513309c7b55634d4dd 100644 (file)
@@ -92,7 +92,7 @@ int ssl3_do_write(SSL_CONNECTION *s, int type)
 
     ret = ssl3_write_bytes(ssl, type, &s->init_buf->data[s->init_off],
                            s->init_num, &written);
-    if (ret < 0)
+    if (ret <= 0)
         return -1;
     if (type == SSL3_RT_HANDSHAKE)
         /*