Skip to content

Commit

Permalink
Merge pull request #26 from duckduckgo/nastia/fix/sni_crash
Browse files Browse the repository at this point in the history
Fix crash in get_server_name
  • Loading branch information
nshuba authored Sep 26, 2023
2 parents 1da4ea7 + 87144b1 commit 3aa1a7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/netguard/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void get_server_name(
} else if (content_type == TLS_TYPE_HANDSHAKE_RECORD) { // content type handshake
// handshake packet type
uint16_t tls_handshake_size = (tls[3] << 8 & 0xFF00) + (tls[4] & 0x00FF);
if (length - (tls - pkt) < 5) {
if (length - (tls - pkt) < tls_handshake_size + 5) {
log_print(PLATFORM_LOG_PRIORITY_DEBUG, "TLS header too short");
} else if (tls[5] == 1) {
log_print(PLATFORM_LOG_PRIORITY_DEBUG, "TLS packet ClientHello msg found");
Expand Down

0 comments on commit 3aa1a7e

Please sign in to comment.