Skip to content

Commit 18d1190

Browse files
authored
Merge pull request #9924 from Frauschi/f-426
Fix potential underflow in sniffer
2 parents f5902bd + 7ed66dd commit 18d1190

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/sniffer.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5074,7 +5074,7 @@ static const byte* DecryptMessage(WOLFSSL* ssl, const byte* input, word32 sz,
50745074

50755075
#ifdef WOLFSSL_TLS13
50765076
if (IsAtLeastTLSv1_3(ssl->version)) {
5077-
if (sz < ssl->specs.aead_mac_size) {
5077+
if (sz <= ssl->specs.aead_mac_size) {
50785078
*error = BUFFER_ERROR;
50795079
return NULL;
50805080
}
@@ -5131,6 +5131,10 @@ static const byte* DecryptMessage(WOLFSSL* ssl, const byte* input, word32 sz,
51315131
#ifdef WOLFSSL_TLS13
51325132
if (IsAtLeastTLSv1_3(ssl->version)) {
51335133
word16 i = (word16)(sz - ssl->keys.padSz);
5134+
if (i == 0) {
5135+
*error = BUFFER_ERROR;
5136+
return NULL;
5137+
}
51345138
/* Remove padding from end of plain text. */
51355139
for (--i; i > 0; i--) {
51365140
if (output[i] != 0)

0 commit comments

Comments
 (0)