From 1c26ca61bc35b35c4900a103edee41d138d64b8d Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Fri, 30 Aug 2019 23:12:04 +0800 Subject: [PATCH] fix null ptr crash --- src/packet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/packet.c b/src/packet.c index 3dc4bde..2875de7 100644 --- a/src/packet.c +++ b/src/packet.c @@ -86,6 +86,7 @@ void print_packet(const struct pcap_pkthdr *pkthdr, const u_char *packet) eprintf("\n\n"); } +static u_char AnyMac[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; int packet_init( struct packet_ctx *self, struct lan_play *arg, @@ -105,6 +106,8 @@ int packet_init( CPY_IPV4(self->subnet_net, subnet_net); CPY_IPV4(self->subnet_mask, subnet_mask); + self->mac = AnyMac; + self->identification = 0; arp_list_init(self->arp_list); self->arp_ttl = arp_ttl;