aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2021-04-02 12:19:46 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2021-04-02 12:19:46 +0100
commitb393720bc6e87d16c5013839553c894f2b163961 (patch)
treea6394f84d15567739706b211e1698724d8ca65aa
parentconfigure.ac: release 2.22 (diff)
downloadsandbox-b393720b.tar.gz
sandbox-b393720b.tar.bz2
sandbox-b393720b.zip
libsandbox: fix error handling of absolute_path() in check_syscall()
The failure is initially observed as a test failure on script/5 test (getcwd against infinite recursion). On the test sandbox was ICEing as: * libsandbox.c:check_syscall():984: failure (Bad address): * ISE: rmdir('confdir3') abs_path: (null) res_path: /confdir3 errno=14: Bad address Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rw-r--r--libsandbox/libsandbox.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c
index 166516c..3d55dd7 100644
--- a/libsandbox/libsandbox.c
+++ b/libsandbox/libsandbox.c
@@ -895,6 +895,9 @@ static int check_syscall(sbcontext_t *sbcontext, int sb_nr, const char *func,
bool access, debug, verbose, set;
absolute_path = resolve_path(file, 0);
+ if (!absolute_path)
+ goto error;
+
/* Do not bother dereferencing symlinks when we are using a function that
* itself does not dereference. This speeds things up and avoids updating
* the atime implicitly. #415475
@@ -980,7 +983,7 @@ static int check_syscall(sbcontext_t *sbcontext, int sb_nr, const char *func,
}
/* If we get here, something bad happened */
- sb_ebort("ISE: %s(%s)\n"
+ sb_ebort("ISE: %s('%s')\n"
"\tabs_path: %s\n"
"\tres_path: %s\n"
"\terrno=%i: %s\n",