From 50933ee0d6abb9fbf74845d7e301d22818748576 Mon Sep 17 00:00:00 2001 From: Vadim Vetrov Date: Thu, 8 Aug 2024 18:19:25 +0300 Subject: [PATCH] Fix last SNI detect --- mangle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mangle.c b/mangle.c index e391986..524c777 100644 --- a/mangle.c +++ b/mangle.c @@ -408,8 +408,12 @@ struct verdict analyze_tls_data( unsigned int j = 0; - for (unsigned int i = 0; i < config.domains_strlen; i++) { - if (config.domains_str[i] == ',' || config.domains_str[i] == '\n') { + for (unsigned int i = 0; i <= config.domains_strlen; i++) { + if ( i == config.domains_strlen || + config.domains_str[i] == '\0' || + config.domains_str[i] == ',' || + config.domains_str[i] == '\n' ) { + unsigned int domain_len = (i - j); const char *sni_startp = sni_name + sni_len - domain_len; const char *domain_startp = config.domains_str + j;