aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-11-23 07:11:47 -0500
committerMike Frysinger <vapier@gentoo.org>2010-11-23 07:11:47 -0500
commit4a383c33005f7ffad6edeed01f78d8e2cca5203d (patch)
tree392d927cd6b10f1bc0a2c9d643658aabb8be7c0d /libsandbox/wrapper-funcs
parenttests: add another unlinkat test for long paths (diff)
downloadsandbox-4a383c33005f7ffad6edeed01f78d8e2cca5203d.tar.gz
sandbox-4a383c33005f7ffad6edeed01f78d8e2cca5203d.tar.bz2
sandbox-4a383c33005f7ffad6edeed01f78d8e2cca5203d.zip
libsandbox: fix bug in previous dirfd unificationv2.4
The previous commit (libsandbox: handle dirfd in mkdir/open/unlink *at prechecks) left a sizeof() in place but unfortunately no longer held the same meaning. In previous code, the function had access to the buffer decl and so could get the byte count. In the new code, the function has access to the pointer only. So sizeof() now wrongly returns the size of pointers rather than the length of the buffer. Extend the new helper function to take the length of the buffer it is given to fix this issue. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox/wrapper-funcs')
-rw-r--r--libsandbox/wrapper-funcs/mkdirat_pre_check.c2
-rw-r--r--libsandbox/wrapper-funcs/openat_pre_check.c2
-rw-r--r--libsandbox/wrapper-funcs/unlinkat_pre_check.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/libsandbox/wrapper-funcs/mkdirat_pre_check.c b/libsandbox/wrapper-funcs/mkdirat_pre_check.c
index d037546..4fef14c 100644
--- a/libsandbox/wrapper-funcs/mkdirat_pre_check.c
+++ b/libsandbox/wrapper-funcs/mkdirat_pre_check.c
@@ -13,7 +13,7 @@ bool sb_mkdirat_pre_check(const char *func, const char *pathname, int dirfd)
save_errno();
/* Expand the dirfd path first */
- switch (resolve_dirfd_path(dirfd, pathname, dirfd_path)) {
+ switch (resolve_dirfd_path(dirfd, pathname, dirfd_path, sizeof(dirfd_path))) {
case -1:
if (is_env_on(ENV_SANDBOX_DEBUG))
SB_EINFO("EARLY FAIL", " %s(%s) @ resolve_dirfd_path: %s\n",
diff --git a/libsandbox/wrapper-funcs/openat_pre_check.c b/libsandbox/wrapper-funcs/openat_pre_check.c
index 4a63413..23149dc 100644
--- a/libsandbox/wrapper-funcs/openat_pre_check.c
+++ b/libsandbox/wrapper-funcs/openat_pre_check.c
@@ -17,7 +17,7 @@ bool sb_openat_pre_check(const char *func, const char *pathname, int dirfd, int
/* Expand the dirfd path first */
char dirfd_path[SB_PATH_MAX];
- switch (resolve_dirfd_path(dirfd, pathname, dirfd_path)) {
+ switch (resolve_dirfd_path(dirfd, pathname, dirfd_path, sizeof(dirfd_path))) {
case -1:
if (is_env_on(ENV_SANDBOX_DEBUG))
SB_EINFO("EARLY FAIL", " %s(%s) @ resolve_dirfd_path: %s\n",
diff --git a/libsandbox/wrapper-funcs/unlinkat_pre_check.c b/libsandbox/wrapper-funcs/unlinkat_pre_check.c
index 4e4a38d..1c4f7e3 100644
--- a/libsandbox/wrapper-funcs/unlinkat_pre_check.c
+++ b/libsandbox/wrapper-funcs/unlinkat_pre_check.c
@@ -13,7 +13,7 @@ bool sb_unlinkat_pre_check(const char *func, const char *pathname, int dirfd)
save_errno();
/* Expand the dirfd path first */
- switch (resolve_dirfd_path(dirfd, pathname, dirfd_path)) {
+ switch (resolve_dirfd_path(dirfd, pathname, dirfd_path, sizeof(dirfd_path))) {
case -1:
if (is_env_on(ENV_SANDBOX_DEBUG))
SB_EINFO("EARLY FAIL", " %s(%s) @ resolve_dirfd_path: %s\n",