summaryrefslogtreecommitdiff
path: root/bin/pax/pax.c
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-03-09 04:23:30 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-03-09 04:23:30 +0000
commitb6b3f50a9ed5827544d33f45b4ea05a0c5df9e34 (patch)
treeb683fe8f50a6acb13f707f6b0670867d3a56dc9a /bin/pax/pax.c
parenta86810706f7590c416472a4fe7763693a8532531 (diff)
Unrevert post-unlock:
* Prevent an archive from esacaping the current directory by itself: when extracting a symlink whose value is absolute or contains ".." components, just create a zero-length normal file (with additional tracking of the mode and hardlinks to the symlink) until everything else is extracted, then go back and replace it with the requested link (if it's still that zero-length placeholder). * For tar without -P, if a path in the archive has any ".." components then strip everything up to and including the last of them (if it ends in ".." then it becomes ".") This mostly follows GNU tar's behavior, except for 'tar tf' and 'tar xvf' we report the modified path that would be/was actually created instead of the raw path from the archive Above two fixes prompted by a report from Daniel Cegielka (daniel.cegielka (at) gmail.com) * For directories whose times or mode will be fixed up in the clean-up pass, record their dev+ino and then use open(O_DIRECTORY)+fstat() to verify that we're updating the correct directory before using futimens() and fchmod(). * Correct buffer overflow in handling of pax extension headers, caught by the memcpy() overlap check. previously ok millert@ deraadt@
Diffstat (limited to 'bin/pax/pax.c')
-rw-r--r--bin/pax/pax.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/pax/pax.c b/bin/pax/pax.c
index 8e2bf4c439a..edb08caec38 100644
--- a/bin/pax/pax.c
+++ b/bin/pax/pax.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pax.c,v 1.40 2015/02/21 22:48:23 guenther Exp $ */
+/* $OpenBSD: pax.c,v 1.41 2015/03/09 04:23:29 guenther Exp $ */
/* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */
/*-
@@ -311,6 +311,7 @@ sig_cleanup(int which_sig)
(void) write(STDERR_FILENO, errbuf, strlen(errbuf));
ar_close(1);
+ sltab_process(1);
proc_dir(1);
if (tflag)
atdir_end();