summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2020-12-30 18:52:40 +0000
committerbenno <benno@openbsd.org>2020-12-30 18:52:40 +0000
commit062ab89c43c8b0c2c8e0a6077e78693cc1e056d2 (patch)
treee7e2cec56e38a2ec4a33a74852ff4fbc49d1ac8c
parentgetifaddrs() can return entries where ifa_addr is NULL. Check for this (diff)
downloadwireguard-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.c7
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) {