Skip to content

Commit e8056ef

Browse files
committed
stricter max fragment length checking
1 parent 52c8afa commit e8056ef

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/internal.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12190,12 +12190,16 @@ static int GetRecordHeader(WOLFSSL* ssl, word32* inOutIdx,
1219012190

1219112191
/* record layer length check */
1219212192
#ifdef HAVE_MAX_FRAGMENT
12193-
if (*size > (ssl->max_fragment + MAX_COMP_EXTRA + MAX_MSG_EXTRA)) {
12193+
if (*size > (ssl->max_fragment + MAX_MSG_EXTRA +
12194+
(ssl->options.usingCompression ? MAX_COMP_EXTRA : 0))) {
12195+
WOLFSSL_MSG_EX("Record length %d exceeds max fragment size", *size);
1219412196
WOLFSSL_ERROR_VERBOSE(LENGTH_ERROR);
1219512197
return LENGTH_ERROR;
1219612198
}
1219712199
#else
12198-
if (*size > (MAX_RECORD_SIZE + MAX_COMP_EXTRA + MAX_MSG_EXTRA)) {
12200+
if (*size > (MAX_RECORD_SIZE + MAX_MSG_EXTRA +
12201+
(ssl->options.usingCompression ? MAX_COMP_EXTRA : 0))) {
12202+
WOLFSSL_MSG_EX("Record length %d exceeds max record size", *size);
1219912203
WOLFSSL_ERROR_VERBOSE(LENGTH_ERROR);
1220012204
return LENGTH_ERROR;
1220112205
}

0 commit comments

Comments
 (0)