summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-08-24 05:42:22 +0000
committerkientzle <kientzle@FreeBSD.org>2008-08-24 05:42:22 +0000
commit1f8b9faf1465aca6cbd84b83e4f65e3275ba6bc5 (patch)
tree43ef05926bcbc818cce8eeecd478fcd23dcf0699 /lib
parent2ba5121e5d45b120bfa91bbf226126b647d56c6d (diff)
downloadFreeBSD-src-1f8b9faf1465aca6cbd84b83e4f65e3275ba6bc5.zip
FreeBSD-src-1f8b9faf1465aca6cbd84b83e4f65e3275ba6bc5.tar.gz
Fail copying path/.. only if SECURE_NODOTDOT was specified.
Since we already warn for any '..' elements in that case, the extra "lastdotdot" tracking turns out to be unnecessary. PR: bin/124924
Diffstat (limited to 'lib')
-rw-r--r--lib/libarchive/Makefile4
-rw-r--r--lib/libarchive/archive_write_disk.c18
2 files changed, 7 insertions, 15 deletions
diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile
index 0d10500..fe30190 100644
--- a/lib/libarchive/Makefile
+++ b/lib/libarchive/Makefile
@@ -227,4 +227,8 @@ MLINKS+= libarchive.3 archive.3
check test:
cd ${.CURDIR}/test && make test
+myclean:
+ rm -f ${CLEANFILES}
+ cd ${.CURDIR}/test && make clean
+
.include <bsd.lib.mk>
diff --git a/lib/libarchive/archive_write_disk.c b/lib/libarchive/archive_write_disk.c
index 3fdea0e..1bed323 100644
--- a/lib/libarchive/archive_write_disk.c
+++ b/lib/libarchive/archive_write_disk.c
@@ -1350,7 +1350,6 @@ cleanup_pathname(struct archive_write_disk *a)
{
char *dest, *src;
char separator = '\0';
- int lastdotdot = 0; /* True if last elt copied was '..' */
dest = src = a->name;
if (*src == '\0') {
@@ -1389,9 +1388,7 @@ cleanup_pathname(struct archive_write_disk *a)
"Path contains '..'");
return (ARCHIVE_FAILED);
}
- lastdotdot = 1;
- } else
- lastdotdot = 0;
+ }
/*
* Note: Under no circumstances do we
* remove '..' elements. In
@@ -1399,10 +1396,8 @@ cleanup_pathname(struct archive_write_disk *a)
* '/foo/../bar/' should create the
* 'foo' dir as a side-effect.
*/
- } else
- lastdotdot = 0;
- } else
- lastdotdot = 0;
+ }
+ }
/* Copy current element, including leading '/'. */
if (separator)
@@ -1421,13 +1416,6 @@ cleanup_pathname(struct archive_write_disk *a)
* We've just copied zero or more path elements, not including the
* final '/'.
*/
- if (lastdotdot) {
- /* Trailing '..' is always wrong. */
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_MISC,
- "Path contains trailing '..'");
- return (ARCHIVE_FAILED);
- }
if (dest == a->name) {
/*
* Nothing got copied. The path must have been something
OpenPOWER on IntegriCloud