From 849b2f560f47b8c1c3d579a06da6aaf82ee89f9f Mon Sep 17 00:00:00 2001 From: codehelp Date: Mon, 28 Feb 2011 16:26:16 +0000 Subject: [PATCH] Protect device-table.pl realpath usage to allow relative directories. git-svn-id: http://emdebian.org/svn/current@7861 563faec7-e20c-0410-992a-a66f704d0ccd --- debian/changelog | 4 +++- device-table.pl | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index a57dd79..b76f6c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,10 @@ multistrap (2.1.13) unstable; urgency=low * Fix device-table.pl to use correct minor device number in iterative mode (Closes: #615819) * Disable SecureApt if fakeroot is detected. + * Protect device-table.pl realpath usage to allow relative + directories. - -- Neil Williams Mon, 28 Feb 2011 09:17:33 +0000 + -- Neil Williams Mon, 28 Feb 2011 16:25:53 +0000 multistrap (2.1.12) unstable; urgency=low diff --git a/device-table.pl b/device-table.pl index af57790..e53f258 100755 --- a/device-table.pl +++ b/device-table.pl @@ -41,6 +41,13 @@ if ($e !~ /\nFAKEROOTKEY=[0-9]+\n/) { } else { $fakeroot=""; } +# cope with people getting things wrong from local SVN (not a translated string). +if (dirname($0) ne "/usr/sbin/") { + print "checking realpath\n"; + my $realpath = `which realpath`; + chomp ($realpath); + die ("ERR: Please install realpath.\n") if (not -x ($realpath)); +} while( @ARGV ) { $_= shift( @ARGV ); last if m/^--$/; @@ -54,6 +61,8 @@ while( @ARGV ) { $file = shift(@ARGV); } elsif (/^(-d|--dir)$/) { $dir = shift(@ARGV); + $dir = `realpath $dir`; + chomp($dir); } elsif (/^(-n|--dry-run)$/) { $dry++; } elsif (/^(--no-fakeroot)$/) {