Skip to content

Commit 19b99f8

Browse files
Ensure the length computed by CheckHeaders in the SSL sniffer does not exceed the actual size of the packets.
Thanks to Haruto Kimura (Stella) for the report.
1 parent 156db7d commit 19b99f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/sniffer.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5520,6 +5520,12 @@ static int CheckHeaders(IpInfo* ipInfo, TcpInfo* tcpInfo, const byte* packet,
55205520
* data after the IP record for the FCS for Ethernet. */
55215521
*sslBytes = (int)(packet + ipInfo->total - *sslFrame);
55225522

5523+
/* Ensure sslBytes does not exceed the actual size. */
5524+
if (*sslBytes > (int)(length - (*sslFrame - packet))) {
5525+
SetError(PACKET_HDR_SHORT_STR, error, NULL, 0);
5526+
return WOLFSSL_FATAL_ERROR;
5527+
}
5528+
55235529
(void)checkReg;
55245530

55255531
return 0;

0 commit comments

Comments
 (0)