diff options
author | 2020-12-30 18:52:40 +0000 | |
---|---|---|
committer | 2020-12-30 18:52:40 +0000 | |
commit | 062ab89c43c8b0c2c8e0a6077e78693cc1e056d2 (patch) | |
tree | e7e2cec56e38a2ec4a33a74852ff4fbc49d1ac8c | |
parent | getifaddrs() can return entries where ifa_addr is NULL. Check for this (diff) | |
download | wireguard-openbsd-062ab89c43c8b0c2c8e0a6077e78693cc1e056d2.tar.xz wireguard-openbsd-062ab89c43c8b0c2c8e0a6077e78693cc1e056d2.zip |
getifaddrs() can return entries where ifa_addr is NULL. Check for this
before accessing anything in ifa_addr.
ok claudio@
-rw-r--r-- | usr.sbin/npppd/pppoe/pppoed.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/npppd/pppoe/pppoed.c b/usr.sbin/npppd/pppoe/pppoed.c index 5b3f09dccb1..e5451fef90d 100644 --- a/usr.sbin/npppd/pppoe/pppoed.c +++ b/usr.sbin/npppd/pppoe/pppoed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pppoed.c,v 1.22 2019/02/22 07:04:20 jmc Exp $ */ +/* $OpenBSD: pppoed.c,v 1.23 2020/12/30 18:52:40 benno Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -28,7 +28,7 @@ /**@file * This file provides the PPPoE(RFC2516) server(access concentrator) * implementaion. - * $Id: pppoed.c,v 1.22 2019/02/22 07:04:20 jmc Exp $ + * $Id: pppoed.c,v 1.23 2020/12/30 18:52:40 benno Exp $ */ #include <sys/param.h> /* ALIGN */ #include <sys/types.h> @@ -256,7 +256,8 @@ pppoed_listener_start(pppoed_listener *_this, int restart) found = 0; for (ifa = ifa0; ifa != NULL; ifa = ifa->ifa_next) { sdl = (struct sockaddr_dl *)ifa->ifa_addr; - if (sdl->sdl_family != AF_LINK || sdl->sdl_type != IFT_ETHER || + if (sdl == NULL || + sdl->sdl_family != AF_LINK || sdl->sdl_type != IFT_ETHER || sdl->sdl_alen != ETHER_ADDR_LEN) continue; if (strcmp(ifa->ifa_name, _this->listen_ifname) == 0) { |