aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMart Raudsepp <leio@gentoo.org>2016-11-11 12:34:48 +0200
committerMichał Górny <mgorny@gentoo.org>2017-09-26 22:14:36 +0200
commitffc185bb4929de36ad3f8766b114cd11be8f0a62 (patch)
treeae4255803c860c17292ed86d4c1486c9a4a98522 /tests
parentlibsandbox: whitelist renameat/symlinkat as symlink funcs (diff)
downloadsandbox-ffc185bb4929de36ad3f8766b114cd11be8f0a62.tar.gz
sandbox-ffc185bb4929de36ad3f8766b114cd11be8f0a62.tar.bz2
sandbox-ffc185bb4929de36ad3f8766b114cd11be8f0a62.zip
libsandbox: do not abort with a long name to opendir
Add a pre-check for opendir that catches too long name arguments given to opendir, as it would get messed up and abort before it even gets to the open*() syscall (which would handle it correctly), due to opendir going through before_syscall/check_syscall, even though it isn't a true syscall and it getting cut to SB_PATH_MAX inbetween and getting confused somewhere. Test case added by Michał Górny <mgorny@gentoo.org>. Bug: https://bugs.gentoo.org/553092 Signed-off-by: Mart Raudsepp <leio@gentoo.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/opendir-1.sh7
-rw-r--r--tests/opendir.at1
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/opendir-1.sh b/tests/opendir-1.sh
new file mode 100755
index 0000000..a66f234
--- /dev/null
+++ b/tests/opendir-1.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# check that very long paths to opendir() do not cause segv
+path=
+for (( i = 0; i < 1000; i++ )); do
+ path+=/verylong
+done
+exec opendir-0 0,ENAMETOOLONG "${path}"
diff --git a/tests/opendir.at b/tests/opendir.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/opendir.at
@@ -0,0 +1 @@
+SB_CHECK(1)