Skip to content

Commit

Permalink
Fix syslog heap overflow introduced in 09fbe0a. (#1579)
Browse files Browse the repository at this point in the history
- fixes #1578

Signed-off-by: lns <[email protected]>
  • Loading branch information
utoni authored Jun 4, 2022
1 parent 09fbe0a commit ff8e1e1
Showing 1 changed file with 2 additions and 3 deletions.
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

0 comments on commit ff8e1e1

Please sign in to comment.