Check TLS Handshake ClientHello byte if packet length is enough

This commit is contained in:
ValdikSS 2021-12-29 16:14:12 +03:00
parent 372cc6a45d
commit 7f59593a28

View File

@ -1076,7 +1076,13 @@ int main(int argc, char *argv[]) {
(do_fake_packet || do_native_frag) (do_fake_packet || do_native_frag)
) )
{ {
if (packet_dataLen >=2 && memcmp(packet_data, "\x16\x03", 2) == 0) { /**
* In case of Window Size fragmentation=2, we'll receive only 2 byte packet.
* But if the packet is more than 2 bytes, check ClientHello byte.
*/
if ((packet_dataLen == 2 && memcmp(packet_data, "\x16\x03", 2) == 0) ||
(packet_dataLen >= 3 && memcmp(packet_data, "\x16\x03\x01", 3) == 0))
{
if (do_blacklist if (do_blacklist
? (extract_sni(packet_data, packet_dataLen, ? (extract_sni(packet_data, packet_dataLen,
&host_addr, &host_len) && &host_addr, &host_len) &&