Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Jul 6, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8629,7 +8629,9 @@ 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), string_to_match_len);
koltiradw marked this conversation as resolved.
Show resolved Hide resolved

if (len >= sizeof(m)) len--;

strncpy(m, string_to_match, len);
m[len] = '\0';
Expand All @@ -8655,7 +8657,9 @@ 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), string_to_match_len);

if (len >= sizeof(m)) len--;

strncpy(m, string_to_match, len);
m[len] = '\0';
Expand Down
Loading