summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-12-26 16:42:38 +0000
committerpfg <pfg@FreeBSD.org>2016-12-26 16:42:38 +0000
commit2dd166267f53df1c3748b4325d294b9b839de74b (patch)
tree41ed2203b7863ad2dd4e1e89a03718882e66642c /bin
parent7b9f32238b6641641aa210013fd40a039efdb8bd (diff)
downloadFreeBSD-src-2dd166267f53df1c3748b4325d294b9b839de74b.zip
FreeBSD-src-2dd166267f53df1c3748b4325d294b9b839de74b.tar.gz
MFC r310367:
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)
Diffstat (limited to 'bin')
-rw-r--r--bin/pax/buf_subs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c
index 4922fc8..40affa5 100644
--- a/bin/pax/buf_subs.c
+++ b/bin/pax/buf_subs.c
@@ -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);
}
OpenPOWER on IntegriCloud