Date: Fri, 24 Dec 1999 12:44:02 +1000 (EST) From: Phil Homewood <philh@mincom.com> To: FreeBSD-gnats-submit@freebsd.org Subject: misc/15662: [PATCH] perl5 Sys::Hostname fails if no PATH set Message-ID: <199912240244.MAA61440@portal.mincom.oz.au>
index | next in thread | raw e-mail
>Number: 15662
>Category: misc
>Synopsis: [PATCH] perl5 Sys::Hostname fails if no PATH set
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Dec 23 18:50:02 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Phil Homewood
>Release: FreeBSD 3.3-STABLE i386
>Organization:
Mincom Limited
>Environment:
>Description:
perl5's Sys::Hostname.pm fails to get local host name if called
with undefined $ENV{'PATH'}. This bug was introduced in r1.2 of
src/contrib/perl5/lib/Hostname.pm with the taint fixes for
backticked commands.
The value returned by each eval{} block is in fact $ENV{'PATH'}
instead of the (defined or undefined nature of) $host.
Thus, the block that calls `hostname` will return true IFF the
path is set. If it isn't, the `uname` block fails in the same
way and the function croaks.
>How-To-Repeat:
Run a script that calls Sys::Hostname::hostname() with an undefined
PATH. Watch it croak.
>Fix:
--- Hostname.pm.orig Fri Oct 1 09:31:37 1999
+++ Hostname.pm Fri Dec 24 12:30:54 1999
@@ -98,6 +98,7 @@
local $SIG{__DIE__};
$host = `(hostname) 2>/dev/null`; # bsdish
$ENV{'PATH'} = $pathstack;
+ $host;
}
# method 4 - sysV uname command (may truncate)
@@ -107,6 +108,7 @@
local $SIG{__DIE__};
$host = `uname -n 2>/dev/null`; ## sysVish
$ENV{'PATH'} = $pathstack;
+ $host;
}
# method 5 - Apollo pre-SR10
>Release-Note:
>Audit-Trail:
>Unformatted:
Phil Homewood
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912240244.MAA61440>
