summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2009-06-19 00:42:04 +0000
committerkrw <krw@openbsd.org>2009-06-19 00:42:04 +0000
commit8d67e39e3eb923b4a92d83da7cd6422f57edc0af (patch)
treeabeb60d3821b386f27ac1f8022565e753fb0f793
parentsync to 1.7.19: escape sequences of the forms \*x and \*(xx are deprecated (diff)
downloadwireguard-openbsd-8d67e39e3eb923b4a92d83da7cd6422f57edc0af.tar.xz
wireguard-openbsd-8d67e39e3eb923b4a92d83da7cd6422f57edc0af.zip
Don't create bogus hosts file entries if too few parameters are
passed to addhostent(). Noticed by sthen@ and jsing@. ok halex@ deraadt@
-rw-r--r--distrib/miniroot/install.sub4
1 files changed, 3 insertions, 1 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 25e9ef34c53..a3ab3683859 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.586 2009/06/12 08:25:57 halex Exp $
+# $OpenBSD: install.sub,v 1.587 2009/06/19 00:42:04 krw Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
@@ -505,6 +505,8 @@ makedev() {
addhostent() {
local _addr=$1 _name=$2 _delim="."
+ [[ -z $_addr || -z $_name ]] && return
+
[[ $_addr == *:* ]] && _delim=":"
sed "/^[0-9a-fA-F]*[$_delim].*[ ]$_name\$/d" /tmp/hosts \