From 21830c460aaccef7fee6fbfb1795bb34b53bb01d Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Sat, 20 Mar 2021 17:12:15 +0500 Subject: ipoe: fix NULL check --- accel-pppd/ctrl/ipoe/ipoe.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 0649e9c8..70c5710a 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -2045,8 +2045,17 @@ static void ipoe_recv_dhcpv4_relay(struct dhcpv4_packet *pack) static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struct ethhdr *eth, struct iphdr *iph, struct _arphdr *arph) { struct ipoe_session *ses; - uint8_t *hwaddr = arph ? arph->ar_sha : eth->h_source; - in_addr_t saddr = arph ? arph->ar_spa : iph->saddr; + uint8_t *hwaddr; + in_addr_t saddr; + + if (arph) { + hwaddr = arph->ar_sha; + saddr = arph->ar_spa; + } else if (eth && iph) { + hwaddr = eth->h_source; + saddr = iph->saddr; + } else + return NULL; if (ap_shutdown) return NULL; -- cgit v1.2.3