From: Matt Caswell Date: Mon, 23 Oct 2023 08:54:16 +0000 (+0100) Subject: Make sure we remember how much data we sent in the event of a retry X-Git-Tag: openssl-3.2.0-beta1~24 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=b9b9f4886f87abd39535721243d4297fd45e558a;p=thirdparty%2Fopenssl.git Make sure we remember how much data we sent in the event of a retry If a retry occurs we need to reset s->rlayer.wnum so that next time around we remember how much data we already sent. Reviewed-by: Hugo Landau Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/22473) --- diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c index 260d163a50d..845eff9848e 100644 --- a/ssl/record/rec_layer_s3.c +++ b/ssl/record/rec_layer_s3.c @@ -294,8 +294,10 @@ int ssl3_write_bytes(SSL *ssl, uint8_t type, const void *buf_, size_t len, /* Retry needed */ i = HANDLE_RLAYER_WRITE_RETURN(s, s->rlayer.wrlmethod->retry_write_records(s->rlayer.wrl)); - if (i <= 0) + if (i <= 0) { + s->rlayer.wnum = tot; return i; + } tot += s->rlayer.wpend_tot; s->rlayer.wpend_tot = 0; } /* else no retry required */ @@ -321,6 +323,7 @@ int ssl3_write_bytes(SSL *ssl, uint8_t type, const void *buf_, size_t len, i = ssl->method->ssl_dispatch_alert(ssl); if (i <= 0) { /* SSLfatal() already called if appropriate */ + s->rlayer.wnum = tot; return i; } /* if it went, fall through and send more stuff */