wpa: Correctly call pcap_next_ex()
The second argument to pcap_next_ex() is a pointer to a pointer.
Not a pointer. This fixes a wpa_supplicent SIGSEGV.
PR: 263266
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Fixes: 6e5d01124f
MFC: immediately
This commit is contained in:
parent
3e0f3678ec
commit
1e0ca65a3b
@ -77,7 +77,7 @@ static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx)
|
|||||||
{
|
{
|
||||||
struct l2_packet_data *l2 = eloop_ctx;
|
struct l2_packet_data *l2 = eloop_ctx;
|
||||||
pcap_t *pcap = sock_ctx;
|
pcap_t *pcap = sock_ctx;
|
||||||
struct pcap_pkthdr hdr;
|
struct pcap_pkthdr *hdr;
|
||||||
const u_char *packet;
|
const u_char *packet;
|
||||||
struct l2_ethhdr *ethhdr;
|
struct l2_ethhdr *ethhdr;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
@ -88,16 +88,16 @@ static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx)
|
|||||||
eloop_terminate();
|
eloop_terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!l2->rx_callback || !packet || hdr.caplen < sizeof(*ethhdr))
|
if (!l2->rx_callback || !packet || hdr->caplen < sizeof(*ethhdr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ethhdr = (struct l2_ethhdr *) packet;
|
ethhdr = (struct l2_ethhdr *) packet;
|
||||||
if (l2->l2_hdr) {
|
if (l2->l2_hdr) {
|
||||||
buf = (unsigned char *) ethhdr;
|
buf = (unsigned char *) ethhdr;
|
||||||
len = hdr.caplen;
|
len = hdr->caplen;
|
||||||
} else {
|
} else {
|
||||||
buf = (unsigned char *) (ethhdr + 1);
|
buf = (unsigned char *) (ethhdr + 1);
|
||||||
len = hdr.caplen - sizeof(*ethhdr);
|
len = hdr->caplen - sizeof(*ethhdr);
|
||||||
}
|
}
|
||||||
l2->rx_callback(l2->rx_callback_ctx, ethhdr->h_source, buf, len);
|
l2->rx_callback(l2->rx_callback_ctx, ethhdr->h_source, buf, len);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user