aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2024-10-17 22:12:52 +0200
committerLuca Deri <deri@ntop.org>2024-10-17 22:12:52 +0200
commit6a744d05443bdd0d079b2abc6c7408a625ebf20d (patch)
tree000131284289dc73d4176386213a5323b9cfef57 /src
parent1c4ae434ab03e1178133ad697bde0e9caff9dd19 (diff)
Fixes buffer overflow when parsing invalid TCP options
Diffstat (limited to 'src')
-rw-r--r--src/lib/ndpi_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 3265ef80f..aa1e58a6b 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -6967,7 +6967,7 @@ static int ndpi_init_packet(struct ndpi_detection_module_struct *ndpi_str,
int j = i+2;
u_int8_t opt_len = len - 2;
- while(opt_len > 0) {
+ while((opt_len > 0) && (j < options_len)) {
rc = snprintf(&options_fp[options_fp_idx], sizeof(options_fp)-options_fp_idx, "%02x", options[j]);
options_fp_idx += rc;
j++, opt_len--;