Date: Thu, 10 Dec 2009 06:42:28 +0000 (UTC) From: Tim Kientzle <kientzle@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r200351 - head/lib/libarchive Message-ID: <200912100642.nBA6gSSh053605@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kientzle Date: Thu Dec 10 06:42:28 2009 New Revision: 200351 URL: http://svn.freebsd.org/changeset/base/200351 Log: Merge two cpio fixes from libarchive.googlecode.com: 1) Avoid an infinite loop in the header resync for certain malformed archives. 2) Don't try to match hardlinks if the nlinks count is < 2. This reduces the likelihood of a false hardlink match due to ino truncation. MFC after: 7 days Modified: head/lib/libarchive/archive_read_support_format_cpio.c Modified: head/lib/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_cpio.c Thu Dec 10 06:24:16 2009 (r200350) +++ head/lib/libarchive/archive_read_support_format_cpio.c Thu Dec 10 06:42:28 2009 (r200351) @@ -356,7 +356,7 @@ find_newc_header(struct archive_read *a) * Scan ahead until we find something that looks * like an odc header. */ - while (p + sizeof(struct cpio_newc_header) < q) { + while (p + sizeof(struct cpio_newc_header) <= q) { switch (p[5]) { case '1': case '2': @@ -490,7 +490,7 @@ find_odc_header(struct archive_read *a) * Scan ahead until we find something that looks * like an odc header. */ - while (p + sizeof(struct cpio_odc_header) < q) { + while (p + sizeof(struct cpio_odc_header) <= q) { switch (p[5]) { case '7': if (memcmp("070707", p, 6) == 0 @@ -731,6 +731,9 @@ record_hardlink(struct cpio *cpio, struc dev_t dev; ino_t ino; + if (archive_entry_nlink(entry) <= 1) + return; + dev = archive_entry_dev(entry); ino = archive_entry_ino(entry);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912100642.nBA6gSSh053605>