summaryrefslogtreecommitdiffstats
path: root/bin/pax
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2004-06-25 05:27:59 +0000
committerobrien <obrien@FreeBSD.org>2004-06-25 05:27:59 +0000
commit8714fd098cfecf289e196445a348f2b304484972 (patch)
treefef22686a875c63bee24a8f3d4319bf232e0a041 /bin/pax
parentb9baf2149270675c183aae828e8de256c6c70e98 (diff)
downloadFreeBSD-src-8714fd098cfecf289e196445a348f2b304484972.zip
FreeBSD-src-8714fd098cfecf289e196445a348f2b304484972.tar.gz
Don't continue if the '-C' option (a-la GNUtar; commited in options.c
rev 1.18, but not documented in the man page) caused a failed chdir. Otherwise, one can easily overwrite files. Submitted by: Robert Nagy <robert@openbsd.org> Obtained from: OpenBSD
Diffstat (limited to 'bin/pax')
-rw-r--r--bin/pax/ar_io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c
index 9fe692d..0ae5042 100644
--- a/bin/pax/ar_io.c
+++ b/bin/pax/ar_io.c
@@ -154,8 +154,10 @@ ar_open(const char *name)
return(-1);
if (chdname != NULL)
- if (chdir(chdname) != 0)
+ if (chdir(chdname) != 0) {
syswarn(1, errno, "Failed chdir to %s", chdname);
+ return(-1);
+ }
/*
* set up is based on device type
*/
OpenPOWER on IntegriCloud