fix Stack overflow caused by invalid write in ndpi_automa_match_strin… (#2035)

* minor fixes

fixed 'handle leak' in ndpi_load_malicious_sha1_file and removed the redundant comparison ndpi_search_eaq

* fix Stack overflow caused by invalid write in ndpi_automa_match_string_subprotocol

* fix compile errors

* fix

---------

Co-authored-by: Ivan Kapranov <i.kapranov@securitycode.ru>
This commit is contained in:
Ivan Kapranov
2023-07-06 11:13:34 +02:00
committed by GitHub
co-authored by Ivan Kapranov
parent bb978907e6
commit bdd295bc2c
+2 -2
View File
@@ -8629,7 +8629,7 @@ static u_int16_t ndpi_automa_match_string_subprotocol(struct ndpi_detection_modu
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
{
char m[256];
int len = ndpi_min(sizeof(m), string_to_match_len);
u_int len = ndpi_min(sizeof(m) - 1, string_to_match_len);
strncpy(m, string_to_match, len);
m[len] = '\0';
@@ -8655,7 +8655,7 @@ static u_int16_t ndpi_automa_match_string_subprotocol(struct ndpi_detection_modu
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
{
char m[256];
int len = ndpi_min(sizeof(m), string_to_match_len);
u_int len = ndpi_min(sizeof(m) - 1, string_to_match_len);
strncpy(m, string_to_match, len);
m[len] = '\0';