From 7bea48e5e850ab4cafbe68d3765cdaba13a86d6f Mon Sep 17 00:00:00 2001 From: Thomas Pornin Date: Mon, 6 Apr 2026 09:40:05 -0400 Subject: [PATCH] Fixed bug in handling incoming records with invalid length (impacted CBC encryption with 3DES or with the aes_small or aes_big AES implementations; only 3DES was selectable by default). Bug was reported by Thai Duong at Calif.io (with some AI stuff from Anthropic Research). --- src/ssl/ssl_rec_cbc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssl/ssl_rec_cbc.c b/src/ssl/ssl_rec_cbc.c index c38cbfd..9e89bb6 100644 --- a/src/ssl/ssl_rec_cbc.c +++ b/src/ssl/ssl_rec_cbc.c @@ -70,7 +70,7 @@ cbc_check_length(const br_sslrec_in_cbc_context *cc, size_t rlen) min_len += blen; max_len += blen; } - return min_len <= rlen && rlen <= max_len; + return min_len <= rlen && rlen <= max_len && (rlen & (blen - 1)) == 0; } /* -- 2.17.1