From cf3b2baf6d1c7dc10b3d07e53346451bd32ae1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 1 Feb 2004 13:50:46 +0000 Subject: [PATCH] Untaint the hostname before trying to use it on a command line. --- tools/tools/tinderbox/tbmaster.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/tools/tinderbox/tbmaster.pl b/tools/tools/tinderbox/tbmaster.pl index 45e4e60ec01..b9ea1816785 100644 --- a/tools/tools/tinderbox/tbmaster.pl +++ b/tools/tools/tinderbox/tbmaster.pl @@ -355,6 +355,11 @@ MAIN:{ chomp($config); $config =~ s/^(\w+)(\..*)?/$1/; $CONFIG{'HOSTNAME'} = `/usr/bin/uname -n`; + if ($CONFIG{'HOSTNAME'} =~ m/^([0-9a-z-]+(?:\.[0-9a-z-]+)*)$/) { + $CONFIG{'HOSTNAME'} = $1; + } else { + $CONFIG{'HOSTNAME'} = 'unknown'; + } if ($ENV{'HOME'} =~ m/^((?:\/[\w\.-]+)+)\/*$/) { $CONFIG{'HOME'} = $1; $etcdir = "$1/etc";