Skip to content

Commit

Permalink
Buffer overflow fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Dec 23, 2023
1 parent 7c4be6d commit 5c7200f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/protocols/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2383,13 +2383,14 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
#endif

ja.client.num_signature_algorithms = ndpi_min(sa_size, MAX_NUM_JA);

for(i=0, id=0; i<tot_signature_algorithms_len && s_offset+i<total_len; i += 2) {
ja.client.signature_algorithms[id++] = ntohs(*(u_int16_t*)&packet->payload[s_offset+i]);
}

for(i=0, id=0; i<tot_signature_algorithms_len && s_offset+i<total_len; i++) {
int rc = ndpi_snprintf(&ja.client.signature_algorithms_str[i*2],
sizeof(ja.client.signature_algorithms_str)-i*2,
"%02X", packet->payload[s_offset+i]);
ja.client.signature_algorithms[id++] = ntohs(*(u_int16_t*)&packet->payload[s_offset+i*2]);

if(rc < 0) break;
}

Expand Down

0 comments on commit 5c7200f

Please sign in to comment.