Skip to content

Commit

Permalink
fix Stack overflow caused by invalid write in ndpi_automa_match_strin… (
Browse files Browse the repository at this point in the history
#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 <[email protected]>
  • Loading branch information
koltiradw and Ivan Kapranov authored Jul 6, 2023
1 parent bb97890 commit bdd295b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down

0 comments on commit bdd295b

Please sign in to comment.