diff options
author | 2014-05-13 11:57:35 +0000 | |
---|---|---|
committer | 2014-05-13 11:57:35 +0000 | |
commit | f94f01becbd95ea4c8f8624d0e20ed78bf60bf88 (patch) | |
tree | 798add43b251f7518ead1cacf494e36be8074f4f /lib/libc/asr/getnetnamadr_async.c | |
parent | Remove some m->m_pkthdr.rcvif dereference to help for upcoming (diff) | |
download | wireguard-openbsd-f94f01becbd95ea4c8f8624d0e20ed78bf60bf88.tar.xz wireguard-openbsd-f94f01becbd95ea4c8f8624d0e20ed78bf60bf88.zip |
skip incomplete entries in /etc/hosts and /etc/networks
fix null deref spotted by Seth Hanford, pinpointed by dtucker@
ok florian@
Diffstat (limited to 'lib/libc/asr/getnetnamadr_async.c')
-rw-r--r-- | lib/libc/asr/getnetnamadr_async.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/asr/getnetnamadr_async.c b/lib/libc/asr/getnetnamadr_async.c index ce3e8cf0526..f030ca92997 100644 --- a/lib/libc/asr/getnetnamadr_async.c +++ b/lib/libc/asr/getnetnamadr_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnetnamadr_async.c,v 1.14 2014/03/26 18:13:15 eric Exp $ */ +/* $OpenBSD: getnetnamadr_async.c,v 1.15 2014/05/13 11:57:35 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -287,6 +287,10 @@ netent_file_match(FILE *f, int reqtype, const char *data) return (NULL); } + /* there must be an address and at least one name */ + if (n < 2) + continue; + if (reqtype == ASR_GETNETBYADDR) { net = inet_network(tokens[1]); if (memcmp(&net, data, sizeof net) == 0) |