aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2022-06-04 08:47:47 +0200
committerGitHub <noreply@github.com>2022-06-04 08:47:47 +0200
commitff8e1e197e900e0d716bca1bb92c44164e66b9ba (patch)
tree5b87d76bf6f34081776c233474ee94e0fd344459
parent09fbe0a64a11b08a35435f516e9a19f7e0c20d7c (diff)
Fix syslog heap overflow introduced in 09fbe0a64a11b08a35435f516e9a19f7e0c20d7c. (#1579)
- fixes #1578 Signed-off-by: lns <matzeton@googlemail.com>
-rw-r--r--src/lib/protocols/syslog.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/protocols/syslog.c b/src/lib/protocols/syslog.c
index 406bf5e8f..866e0a0c0 100644
--- a/src/lib/protocols/syslog.c
+++ b/src/lib/protocols/syslog.c
@@ -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)
{
@@ -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);