Skip to content

Commit

Permalink
win32 pcapif: fix "heap-use-after-free" on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
goldsimon committed Sep 27, 2023
1 parent 3792075 commit f7fe057
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions contrib/ports/win32/pcapif.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,17 @@ pcapif_shutdown(struct netif *netif)
#endif /* PCAPIF_RX_USE_THREAD */
if (pa->adapter) {
pcap_breakloop(pa->adapter);
pcap_close(pa->adapter);
}
#if PCAPIF_RX_USE_THREAD
/* wait for rxthread to end */
while(pa->rx_running);
while (pa->rx_running) {
Sleep(100);
}
#endif /* PCAPIF_RX_USE_THREAD */
if (pa->adapter) {
pcap_close(pa->adapter);
pa->adapter = NULL;
}
#if PCAPIF_HANDLE_LINKSTATE
pcapifh_linkstate_close(pa->link_state);
#endif /* PCAPIF_HANDLE_LINKSTATE */
Expand Down

0 comments on commit f7fe057

Please sign in to comment.