From owner-svn-src-all@FreeBSD.ORG Thu Dec 10 06:42:28 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C306B106568B; Thu, 10 Dec 2009 06:42:28 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B17E48FC0A; Thu, 10 Dec 2009 06:42:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBA6gSiJ053607; Thu, 10 Dec 2009 06:42:28 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBA6gSSh053605; Thu, 10 Dec 2009 06:42:28 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200912100642.nBA6gSSh053605@svn.freebsd.org> From: Tim Kientzle Date: Thu, 10 Dec 2009 06:42:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200351 - head/lib/libarchive X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2009 06:42:28 -0000 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);