Skip to content

Commit

Permalink
Fix ssl3_write_pending, BIO_write returns 0 is considered a success
Browse files Browse the repository at this point in the history
  • Loading branch information
dongbeiouba committed Jun 27, 2024
1 parent 8a971f9 commit e4f070e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ssl/record/rec_layer_s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,13 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len,
SSL_R_BIO_NOT_SET);
i = -1;
}
if (i > 0 && tmpwrit == SSL3_BUFFER_get_left(&wb[currbuf])) {

/*
* If zero byte write succeeds, i will be 0 rather than a non-zero
* value. Treat i == 0 as success rather than an error for zero byte
* writes to permit this case.
*/
if (i >= 0 && tmpwrit == SSL3_BUFFER_get_left(&wb[currbuf])) {
SSL3_BUFFER_set_left(&wb[currbuf], 0);
SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit);
if (currbuf + 1 < s->rlayer.numwpipes)
Expand Down

0 comments on commit e4f070e

Please sign in to comment.