From 59a867a89ace440ac875e5d4df4993f13fad8333 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Fri, 19 Jun 2009 00:42:05 +0000 Subject: Don't create bogus hosts file entries if too few parameters are passed to addhostent(). Noticed by sthen@ and jsing@. ok halex@ deraadt@ --- distrib/miniroot/install.sub | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'distrib/miniroot') 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 \ -- cgit v1.2.3