diff options
author | hopper-vul <hopper.vul@gmail.com> | 2022-12-21 14:34:59 +0800 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2022-12-21 09:11:18 +0100 |
commit | eae1a8597f0c88508b3f756c69daefc3dd814e99 (patch) | |
tree | e6a9cfc59f2e88af8cf4f5b27e6ae6b8c289e7be /pcap.c | |
parent | 2b8bfe0ccb007dd1c268f62c51d4a1e4809bd7a2 (diff) |
Fix two null pointer crashes of breakloop and can_set_rfmon
pcap_open_dead and pcap_fopen_offline has not initialized the breakloop_op and can_set_rfmon_op callback respectively,
if pcap_breakloop() is called followed by pcap_open_dead() and pcap_can_set_rfmon() is called followed by pcap_fopen_offline()
then the null function pointer crashes will happen.
This commit adds two default implementation pcap_breakloop_dead and sf_cant_set_rfmon and uses them to initialize those two missed callbacks.
Signed-off-by: hopper-vul <hopper.vul@gmail.com>
Diffstat (limited to 'pcap.c')
-rw-r--r-- | pcap.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -4212,6 +4212,14 @@ pcap_read_dead(pcap_t *p, int cnt _U_, pcap_handler callback _U_, } static int +pcap_breakloop_dead(pcap_t *p) +{ + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "A breakloop cannot be set on a pcap_open_dead pcap_t"); + return (-1); +} + +static int pcap_inject_dead(pcap_t *p, const void *buf _U_, int size _U_) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, @@ -4424,6 +4432,7 @@ pcap_open_dead_with_tstamp_precision(int linktype, int snaplen, u_int precision) p->live_dump_ended_op = pcap_live_dump_ended_dead; p->get_airpcap_handle_op = pcap_get_airpcap_handle_dead; #endif + p->breakloop_op = pcap_breakloop_dead; p->cleanup_op = pcap_cleanup_dead; /* |