]> 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:42:51 +0000 (09:42 +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/21435)

ssl/statem/statem_lib.c

index 71da19fd9ca1f737dd2e19d65af09dd886fd2db1..14b5345a039d51beee068ddfe7be4b491594fc8b 100644 (file)
@@ -47,7 +47,7 @@ int ssl3_do_write(SSL *s, int type)
 
     ret = ssl3_write_bytes(s, 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)
         /*