mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-04-28 23:19:42 +00:00
Crash fix when -f is specified with a non-existing pcap file (-i)
This commit is contained in:
parent
183175fc6b
commit
35ef56cc24
1 changed files with 4 additions and 2 deletions
|
|
@ -4465,9 +4465,10 @@ static int getNextPcapFileFromPlaylist(u_int16_t thread_id, char filename[], u_i
|
|||
* @brief Configure the pcap handle
|
||||
*/
|
||||
static void configurePcapHandle(pcap_t * pcap_handle) {
|
||||
|
||||
if(!pcap_handle)
|
||||
return;
|
||||
|
||||
if(bpfFilter != NULL) {
|
||||
|
||||
if(!bpf_cfilter) {
|
||||
if(pcap_compile(pcap_handle, &bpf_code, bpfFilter, 1, 0xFFFFFF00) < 0) {
|
||||
printf("pcap_compile error: '%s'\n", pcap_geterr(pcap_handle));
|
||||
|
|
@ -4475,6 +4476,7 @@ static void configurePcapHandle(pcap_t * pcap_handle) {
|
|||
}
|
||||
bpf_cfilter = &bpf_code;
|
||||
}
|
||||
|
||||
if(pcap_setfilter(pcap_handle, bpf_cfilter) < 0) {
|
||||
printf("pcap_setfilter error: '%s'\n", pcap_geterr(pcap_handle));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue