Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Dec 2016 15:26:59 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310367 - head/bin/pax
Message-ID:  <201612211526.uBLFQxca016212@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Wed Dec 21 15:26:59 2016
New Revision: 310367
URL: https://svnweb.freebsd.org/changeset/base/310367

Log:
  pax(1):	Fix a bug with archives smaller than 512 bytes.
  
  The problem here is that the archive is too short (< 512 bytes). The
  buffer routines, try to read at least 512 bytes, even when we try to
  determine what format file we have, which is wrong.
  
  Obtained from:	NetBSD (CVS rev 1.26)
  MFC after:	5 days

Modified:
  head/bin/pax/buf_subs.c

Modified: head/bin/pax/buf_subs.c
==============================================================================
--- head/bin/pax/buf_subs.c	Wed Dec 21 15:17:47 2016	(r310366)
+++ head/bin/pax/buf_subs.c	Wed Dec 21 15:26:59 2016	(r310367)
@@ -852,10 +852,13 @@ buf_fill(void)
 
 		/*
 		 * errors require resync, EOF goes to next archive
+		 * but in case we have not determined yet the format,
+		 * this means that we have a very short file, so we
+		 * are done again.
 		 */
 		if (cnt < 0)
 			break;
-		if (ar_next() < 0) {
+		if (frmt == NULL || ar_next() < 0) {
 			fini = 1;
 			return(0);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612211526.uBLFQxca016212>