Skip to content

Commit

Permalink
Fix ssl3_do_write() to correctly handle retries
Browse files Browse the repository at this point in the history
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 openssl#21422

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from openssl#21435)

(cherry picked from commit 034ea1d)
  • Loading branch information
mattcaswell authored and bernd-edlinger committed Aug 19, 2023
1 parent 73a8cb1 commit a20e0be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ssl/statem/statem_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,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)
/*
Expand Down

0 comments on commit a20e0be

Please sign in to comment.