aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-06-23 18:33:01 +0200
committerToni Uhlig <matzeton@googlemail.com>2020-06-23 18:35:50 +0200
commitca68beda85b6b2fb8f96d9465997c0a371e3d152 (patch)
tree18f4704b6305512f15f88fcb5e3ffe92ad4efac5 /src/lib/protocols
parentd9af1562f00d2b9ac9fe5f4e745a84164656fea1 (diff)
Fixed missing length check in fbzero.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/lib/protocols')
-rw-r--r--src/lib/protocols/fbzero.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/protocols/fbzero.c b/src/lib/protocols/fbzero.c
index 6c818e3c7..936d99e84 100644
--- a/src/lib/protocols/fbzero.c
+++ b/src/lib/protocols/fbzero.c
@@ -85,9 +85,12 @@ void ndpi_search_fbzero(struct ndpi_detection_module_struct *ndpi_struct,
char *value = (char*)&packet->payload[data_offset + data_prev_offset];
u_int tag_len = t->tag_offset_len-data_prev_offset, max_len;
ndpi_protocol_match_result ret_match;
-
+
max_len = ndpi_min(tag_len, sizeof(flow->host_server_name)-1);
+ if (data_offset + data_prev_offset + max_len >= packet->payload_packet_len) {
+ return;
+ }
strncpy((char*)flow->host_server_name, value, max_len);
flow->host_server_name[max_len] = '\0';