File: 01-taint

package info (click to toggle)
libproc-pid-file-perl 1.27-4.2
  • links: PTS
  • area: main
  • in suites: sid
  • size: 140 kB
  • sloc: perl: 485; makefile: 39
file content (20 lines) | stat: -rw-r--r-- 876 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Author: Alexander Zangerl <az@debian.org>
Subject: save and restore path before modifying it (to survive taint checks)

diff -urNad libproc-pid-file-perl-1.27~/File.pm libproc-pid-file-perl-1.27/File.pm
--- libproc-pid-file-perl-1.27~/File.pm	2010-04-25 14:36:00.000000000 +1000
+++ libproc-pid-file-perl-1.27/File.pm	2010-04-25 15:04:05.011672928 +1000
@@ -253,10 +253,12 @@
 				}
 			}
 		my $cols = delete($ENV{'COLUMNS'}); # prevents `ps` from wrapping
+	my $oldpath=$ENV{'PATH'};
+ 	$ENV{'PATH'} = "/usr/bin:/bin"; # to survive the taint checks
         my @ps = split m|$/|, qx/ps -fp $pid/
             || die "ps utility not available: $!";
         s/^\s+// for @ps;   # leading spaces confuse us
-
+	$ENV{'PATH'}=$oldpath;
 		$ENV{'COLUMNS'} = $cols if defined($cols);
         no warnings;    # hate that deprecated @_ thing
         my $n = split(/\s+/, $ps[0]);