Skip to content

Commit a6195c3

Browse files
Merge pull request wolfSSL#9947 from kareem-wolfssl/zd21325
Ensure the length computed by CheckHeaders in the SSL sniffer does not exceed the actual size of the packets.
2 parents aa9ee8b + 94b370f commit a6195c3

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 - (ipInfo->length + tcpInfo->length))) {
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)