Skip to content

Commit

Permalink
Fixes buffer overflow when parsing invalid TCP options
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Oct 17, 2024
1 parent 1c4ae43 commit 6a744d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
Expand Down

0 comments on commit 6a744d0

Please sign in to comment.