diff options
author | Ivan Kapranov <44571881+koltiradw@users.noreply.github.com> | 2023-07-06 12:13:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-06 11:13:34 +0200 |
commit | bdd295bc2c8ec51357b4b43db17b50844acce540 (patch) | |
tree | 56f622563e4dc7e1d4a24f293af1b6b9e5f9e056 /src | |
parent | bb978907e63a058894643a6a612734eeab291b58 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ndpi_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index ab5f7b6e8..839e8a334 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -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'; |