aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-08-14 12:37:02 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-08-14 15:19:17 +0200
commit2f494d26a65cde5da1ef797070bc439f2431265c (patch)
treeb5d4422a838d3906f0e73baa4d07b9727eae3e17
parentc2aac9df8b5b29780bfc4a32fd38facf6a9b84a6 (diff)
Add a test case for the path traversal bug
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--.gitignore1
-rw-r--r--configure.ac2
-rw-r--r--tests/Makemodule.am7
-rw-r--r--tests/rdsquashfs/pathtraversal.sh.in12
-rw-r--r--tests/rdsquashfs/pathtraversal.sqfsbin0 -> 4096 bytes
5 files changed, 22 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 3501319..2703619 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,6 +42,7 @@ m4/libtool.m4
m4/lt*.m4
Doxyfile
tests/*.sh
+tests/rdsquashfs/*.sh
/mknastyfs
/mk42sqfs
/list_files
diff --git a/configure.ac b/configure.ac
index b6cef1b..ebcbeda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,6 +252,8 @@ AC_CONFIG_FILES([Doxyfile])
AC_CONFIG_FILES([tests/cantrbry.sh], [chmod +x tests/cantrbry.sh])
AC_CONFIG_FILES([tests/test_tar_sqfs.sh], [chmod +x tests/test_tar_sqfs.sh])
AC_CONFIG_FILES([tests/pack_dir_root.sh], [chmod +x tests/pack_dir_root.sh])
+AC_CONFIG_FILES([tests/rdsquashfs/pathtraversal.sh],
+ [chmod +x tests/rdsquashfs/pathtraversal.sh])
AC_OUTPUT([Makefile])
diff --git a/tests/Makemodule.am b/tests/Makemodule.am
index e1a3a26..414d239 100644
--- a/tests/Makemodule.am
+++ b/tests/Makemodule.am
@@ -272,3 +272,10 @@ EXTRA_DIST += $(top_srcdir)/tests/fstree1.txt
EXTRA_DIST += $(top_srcdir)/tests/corpus/cantrbry.tar.xz
EXTRA_DIST += $(top_srcdir)/tests/corpus/cantrbry.sha512
EXTRA_DIST += $(top_srcdir)/tests/pack_dir_root.txt.ref
+EXTRA_DIST += $(top_srcdir)/tests/rdsquashfs/pathtraversal.sqfs
+
+if WINDOWS
+else
+check_SCRIPTS += tests/rdsquashfs/pathtraversal.sh
+TESTS += tests/rdsquashfs/pathtraversal.sh
+endif
diff --git a/tests/rdsquashfs/pathtraversal.sh.in b/tests/rdsquashfs/pathtraversal.sh.in
new file mode 100644
index 0000000..6dd9fab
--- /dev/null
+++ b/tests/rdsquashfs/pathtraversal.sh.in
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+RDSQFS="@abs_top_builddir@/rdsquashfs"
+REFFILE="@abs_top_srcdir@/tests/rdsquashfs/pathtraversal.sqfs"
+GOTCHA="/tmp/gotcha.txt"
+
+if "$RDSQFS" -u / -p . "$REFFILE"; then
+ if [ -e "$GOTCHA" ]; then
+ echo "Found $GOTCHA which should not be there"
+ exit 1
+ fi
+fi
diff --git a/tests/rdsquashfs/pathtraversal.sqfs b/tests/rdsquashfs/pathtraversal.sqfs
new file mode 100644
index 0000000..0c33bb3
--- /dev/null
+++ b/tests/rdsquashfs/pathtraversal.sqfs
Binary files differ