The following commit has been merged in the master branch:
commit 75d158bcd3390bf3d7bb742a5d80551807aa29e5
Author: Niels Thykier <[email protected]>
Date:   Fri Apr 5 10:11:34 2013 +0200

    coll/debian-readme: Check that usr/share/doc/<pkg> is safe
    
    At the same time, stop looking at files in usr/doc/<pkg>.
    
    Signed-off-by: Niels Thykier <[email protected]>

diff --git a/collection/debian-readme b/collection/debian-readme
index 48e5cc3..e9073f4 100755
--- a/collection/debian-readme
+++ b/collection/debian-readme
@@ -25,7 +25,7 @@ use strict;
 use warnings;
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Util qw(fail gunzip_file touch_file);
+use Lintian::Util qw(fail gunzip_file touch_file is_ancestor_of);
 
 sub collect {
 my ($pkg, $type, $dir) = @_;
@@ -39,10 +39,14 @@ my @readmes = 
("$dir/unpacked/usr/share/doc/$pkg/README.Debian.gz",
                "$dir/unpacked/usr/share/doc/$pkg/README.Debian",
                "$dir/unpacked/usr/share/doc/$pkg/README.debian.gz",
                "$dir/unpacked/usr/share/doc/$pkg/README.debian",
-               "$dir/unpacked/usr/doc/$pkg/README.Debian.gz",
-               "$dir/unpacked/usr/doc/$pkg/README.Debian",
-               "$dir/unpacked/usr/doc/$pkg/README.debian.gz",
-               "$dir/unpacked/usr/doc/$pkg/README.debian");
+    );
+
+if (-d "$dir/unpacked/usr/share/doc/$pkg"
+      && !is_ancestor_of("$dir/unpacked", "$dir/unpacked/usr/share/doc/$pkg")) 
{
+    # Unsafe path, stop here
+    touch_file("$dir/README.Debian");
+    return;
+}
 
 my $file;
 for (@readmes) {
diff --git a/debian/changelog b/debian/changelog
index 5a4df73..7048e02 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -159,7 +159,7 @@ lintian (2.5.12) UNRELEASED; urgency=low
     + [NT] New check written by Nicolas Boulenguez to catch some
       mistakes with the new autopkgtest tests.
 
-  * collection/changelog-file:
+  * collection/{changelog-file,debian-readme}:
     + [NT] Ignore files in usr/doc/<pkg>.
     + [NT] Skip collection if usr/share/doc/<pkg> is not contained
       within the package root.

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to