Просмотр исходного кода

Merge branch 'sid' (through tag '1.15.8.3')

Conflicts:
	debian/changelog
Guillem Jover лет назад: 16
Родитель
Сommit
f56c9fc6a0
3 измененных файлов с 27 добавлено и 9 удалено
  1. 15 0
      debian/changelog
  2. 7 4
      lib/dpkg/ar.c
  3. 5 5
      src/t/100_dpkg_divert.t

+ 15 - 0
debian/changelog

@@ -11,6 +11,21 @@ dpkg (1.15.9) UNRELEASED; urgency=low
 
  -- Guillem Jover <guillem@debian.org>  Thu, 29 Jul 2010 11:00:22 +0200
 
+dpkg (1.15.8.3) unstable; urgency=low
+
+  [ Raphaël Hertzog ]
+  * Fix dpkg-divert test suite to cope with + and other special characters for
+    regexps in the build directory name. Thanks to Jonathan Nieder for the
+    patch and to Phil Kern for the report. Closes: #591182
+
+  [ Guillem Jover ]
+  * Fix buffer overflow in dpkg_ar_member_put_header causing it to write the
+    header to fd 0 (instead of ar_fd) depending on the stack layout, affecting
+    armel. Thanks to Phil Kern for the analysis and Reinhard Tartler for the
+    initial patch. Closes: #591312
+
+ -- Guillem Jover <guillem@debian.org>  Mon, 02 Aug 2010 10:38:07 +0200
+
 dpkg (1.15.8.2) unstable; urgency=low
 
   * Bump libdpkg-perl Depends on dpkg to 1.15.8, as it will break dpkg

+ 7 - 4
lib/dpkg/ar.c

@@ -58,12 +58,15 @@ void
 dpkg_ar_member_put_header(const char *ar_name, int ar_fd,
                           const char *name, size_t size)
 {
-	char header[sizeof(struct ar_hdr)];
+	char header[sizeof(struct ar_hdr) + 1];
+	int n;
 
-	sprintf(header, "%-16s%-12lu0     0     100644  %-10lu`\n",
-	        name, time(NULL), (unsigned long)size);
+	n = sprintf(header, "%-16s%-12lu0     0     100644  %-10lu`\n",
+	            name, time(NULL), (unsigned long)size);
+	if (n != sizeof(struct ar_hdr))
+		ohshit(_("generated corrupt ar header for '%s'"), ar_name);
 
-	if (write(ar_fd, header, sizeof(header)) < 0)
+	if (write(ar_fd, header, n) < 0)
 		ohshite(_("unable to write file '%s'"), ar_name);
 }
 

+ 5 - 5
src/t/100_dpkg_divert.t

@@ -236,7 +236,7 @@ install_diversions('');
 
 system("touch $testdir/foo");
 call_divert(['--rename', '--add', "$testdir/foo"],
-            expect_stdout_like => qr,Adding.*local.*diversion.*$testdir/foo.*$testdir/foo.distrib,,
+            expect_stdout_like => qr,Adding.*local.*diversion.*\Q$testdir\E/foo.*\Q$testdir\E/foo.distrib,,
             expect_stderr => '');
 ok(-e "$testdir/foo.distrib", "foo diverted");
 ok(!-e "$testdir/foo", "foo diverted");
@@ -250,7 +250,7 @@ install_diversions('');
 
 system("touch $testdir/foo");
 call_divert(['--add', "$testdir/foo"],
-            expect_stdout_like => qr,Adding.*local.*diversion.*$testdir/foo.*$testdir/foo.distrib,,
+            expect_stdout_like => qr,Adding.*local.*diversion.*\Q$testdir\E/foo.*\Q$testdir\E/foo.distrib,,
             expect_stderr => '');
 ok(!-e "$testdir/foo.distrib", "foo diverted");
 ok(-e "$testdir/foo", "foo diverted");
@@ -408,7 +408,7 @@ call_divert(["--package", "baz", "--divert", "$testdir/foo.my", "--remove", "$te
             expect_failure => 1, expect_stderr_like =>qr/mismatch on (package|divert-to)/);
 
 call_divert(["--divert", "$testdir/foo.distrib", "--remove", "$testdir/foo"],
-            expect_stdout_like => qr,Removing.*$testdir/foo,);
+            expect_stdout_like => qr,Removing.*\Q$testdir\E/foo,);
 diversions_eq(<<EOF);
 $testdir/bar
 $testdir/bar.distrib
@@ -429,7 +429,7 @@ call_divert(["$testdir/bar"]);
 call_divert(["$testdir/baz"]);
 
 call_divert(["--remove", "$testdir/bar"],
-            expect_stdout_like => qr,Removing.*$testdir/bar,);
+            expect_stdout_like => qr,Removing.*\Q$testdir\E/bar,);
 diversions_eq(<<EOF);
 $testdir/foo
 $testdir/foo.distrib
@@ -469,7 +469,7 @@ system("touch $testdir/foo");
 call_divert(["--rename", "$testdir/foo"]);
 
 call_divert(["--test", "--rename", "--remove", "$testdir/foo"],
-            expect_stdout_like => qr,Removing.*$testdir/foo,, expect_stderr => '');
+            expect_stdout_like => qr,Removing.*\Q$testdir\E/foo,, expect_stderr => '');
 ok(-e "$testdir/foo.distrib");
 ok(!-e "$testdir/foo");
 diversions_eq($diversions_added_foo_local);