Skip to content

Commit 1aa1cec

Browse files
committed
dtls13: limit max number of ack records to 128
1 parent 350a9bf commit 1aa1cec

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

wolfssl/internal.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5859,8 +5859,17 @@ enum {
58595859

58605860
/* 64-bit epoch + 64-bit sequence number */
58615861
#define DTLS13_RN_SIZE (OPAQUE64_LEN + OPAQUE64_LEN)
5862-
/* Maximum number of ACK records encodable in the word16 length field */
5863-
#define DTLS13_ACK_MAX_RECORDS ((int)(WOLFSSL_MAX_16BIT / DTLS13_RN_SIZE))
5862+
/* Maximum number of ACK records allowed in a ACK record */
5863+
#ifndef DTLS13_ACK_MAX_RECORDS
5864+
#define DTLS13_ACK_MAX_RECORDS 128
5865+
#endif
5866+
/* WOLFSSL_MAX_16BIT / DTLS13_RN_SIZE (0xffff / (OPAQUE64_LEN + OPAQUE64_LEN))
5867+
* Literals are used because OPAQUE64_LEN is an enum value, invisible to the
5868+
* preprocessor. */
5869+
#if DTLS13_ACK_MAX_RECORDS > 0xffff / 16
5870+
#error "DTLS13_ACK_MAX_RECORDS exceeds the maximum encodable in the word16 length field"
5871+
#endif
5872+
58645873

58655874
typedef struct Dtls13Epoch {
58665875
w64wrapper epochNumber;

0 commit comments

Comments
 (0)