Untaint the hostname before trying to use it on a command line.

This commit is contained in:
des 2004-02-01 13:50:46 +00:00
parent 940ebef14f
commit 9f4d1431c3

View File

@ -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";