瀏覽代碼

dpkg-deb: Fix off-by-one write access on versionbuf variable

Closes: #798324
Warned-by: afl
Reported-by: Jacek Wielemborek <d33tah@gmail.com>
Stable-Candidate: 1.16.x 1.17.x
Guillem Jover 11 年之前
父節點
當前提交
e65aa3db04
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 2 0
      debian/changelog
  2. 1 1
      dpkg-deb/extract.c

+ 2 - 0
debian/changelog

@@ -13,6 +13,8 @@ dpkg (1.18.3) UNRELEASED; urgency=low
   * Add kfreebsd-armhf support to ostable and triplettable. Closes: #796283
     Thanks to Steven Chamberlain <steven@pyro.eu.org>.
   * Fix «dpkg --verify» with --root.
+  * Fix an off-by-one write access in dpkg-deb when parsing the .deb magic.
+    Reported by Jacek Wielemborek <d33tah@gmail.com>. Closes: #798324
   * Perl modules:
     - Only warn on invalid week days instead of aborting in
       Dpkg::Changelog::Entry::Debian. Regression introduced in dpkg 1.18.2.

+ 1 - 1
dpkg-deb/extract.c

@@ -131,7 +131,7 @@ extracthalf(const char *debar, const char *dir,
   if (fstat(arfd, &stab))
     ohshite(_("failed to fstat archive"));
 
-  r = read_line(arfd, versionbuf, strlen(DPKG_AR_MAGIC), sizeof(versionbuf));
+  r = read_line(arfd, versionbuf, strlen(DPKG_AR_MAGIC), sizeof(versionbuf) - 1);
   if (r < 0)
     read_fail(r, debar, _("archive magic version number"));