Skip to content

Commit

Permalink
Fix memory leak (#2340)
Browse files Browse the repository at this point in the history
```
Direct leak of 12 byte(s) in 1 object(s) allocated from:
    #0 0x55779e1a46ff in malloc (/home/ivan/svnrepos/nDPI/example/ndpiReader+0x8706ff) (BuildId: 14c2fc626744710d49d652ea1c5bbb24a8cbab4f)
    #1 0x55779e2120c7 in ndpi_malloc_wrapper /home/ivan/svnrepos/nDPI/example/ndpiReader.c:298:10
    #2 0x55779e5fa215 in ndpi_malloc /home/ivan/svnrepos/nDPI/src/lib/ndpi_memory.c:60:25
    #3 0x55779e5fa500 in ndpi_strdup /home/ivan/svnrepos/nDPI/src/lib/ndpi_memory.c:113:13
    #4 0x55779e42153c in processClientServerHello /home/ivan/svnrepos/nDPI/src/lib/protocols/tls.c:2554:46
    #5 0x55779e4359a1 in processTLSBlock /home/ivan/svnrepos/nDPI/src/lib/protocols/tls.c:908:5
    #6 0x55779e432de7 in ndpi_search_tls_tcp /home/ivan/svnrepos/nDPI/src/lib/protocols/tls.c:1097:2
    #7 0x55779e4133f9 in ndpi_search_tls_wrapper /home/ivan/svnrepos/nDPI/src/lib/protocols/tls.c:2913:5
```

Found by oss-fuzz
See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=67250
  • Loading branch information
IvanNardi authored Mar 7, 2024
1 parent 1fb4719 commit c09b4da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/ndpi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7413,7 +7413,7 @@ static void ndpi_reconcile_protocols(struct ndpi_detection_module_struct *ndpi_s
}
} else if(flow->guessed_protocol_id_by_ip == NDPI_PROTOCOL_TELEGRAM) {
ndpi_int_change_protocol(ndpi_str, flow,
flow->guessed_protocol_id_by_ip, flow->detected_protocol_stack[1],
flow->guessed_protocol_id_by_ip, flow->detected_protocol_stack[0],
NDPI_CONFIDENCE_DPI_PARTIAL);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/protocols/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
}

#ifdef DEBUG_TLS
printf("Client TLS [SUPPORTED_VERSIONS: %s]\n", ja.client.supported_versions_str);
printf("Client TLS [SUPPORTED_VERSIONS: %s]\n", version_str);
#endif

if(flow->protos.tls_quic.tls_supported_versions == NULL)
Expand Down

0 comments on commit c09b4da

Please sign in to comment.