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 syslog heap overflow introduced in 09fbe0a64a11b08a35435f516e9a19… #1579

Merged
merged 1 commit into from
Jun 4, 2022
Merged
Changes from all 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
5 changes: 2 additions & 3 deletions src/lib/protocols/syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void ndpi_search_syslog(struct ndpi_detection_module_struct
NDPI_LOG_DBG2(ndpi_struct, "no blank following the >: do nothing\n");
}

while (i < packet->payload_packet_len)
while (i < packet->payload_packet_len - 1)
{
if (ndpi_isalnum(packet->payload[i]) == 0)
{
Expand All @@ -86,8 +86,7 @@ void ndpi_search_syslog(struct ndpi_detection_module_struct

if (packet->payload[i] == ':')
{
i++;
if (i >= packet->payload_packet_len ||
if (++i >= packet->payload_packet_len ||
packet->payload[i] != ' ')
{
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
Expand Down