Skip to content

Commit

Permalink
Dons ndpi patch updated for ndpi 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hl33ta committed May 12, 2022
1 parent 8b5c6af commit 8e7f904
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4465,8 +4465,22 @@ void ndpi_free_flow_data(struct ndpi_flow_struct* flow) {
}

if(flow->l4_proto == IPPROTO_TCP) {
if(flow->l4.tcp.tls.message.buffer)
ndpi_free(flow->l4.tcp.tls.message.buffer);
if(flow->l4.tcp.tls.message.buffer) {
// CFAI patch here, check buffer_len in addition to pointer itself
if( flow->l4.tcp.tls.message.buffer_len == 0 ) {
fprintf(stderr,"[nDPI:CFAI] Skip freeing of (%d bytes, %u used) message buffer at %p.\n",
flow->l4.tcp.tls.message.buffer_len,
flow->l4.tcp.tls.message.buffer_used,
flow->l4.tcp.tls.message.buffer);
fflush(stderr);
} else {
ndpi_free(flow->l4.tcp.tls.message.buffer);
// Reset buffer length vars after free.
flow->l4.tcp.tls.message.buffer = NULL;
flow->l4.tcp.tls.message.buffer_len = flow->l4.tcp.tls.message.buffer_used = 0;
}
}

}

if(flow->l4_proto == IPPROTO_UDP) {
Expand Down

0 comments on commit 8e7f904

Please sign in to comment.