Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 553092 | Differences between
and this patch

Collapse All | Expand All

(-)a/libsandbox/wrapper-funcs/opendir.c (+2 lines)
Lines 10-13 Link Here
10
#define WRAPPER_SAFE() SB_SAFE(name)
10
#define WRAPPER_SAFE() SB_SAFE(name)
11
#define WRAPPER_RET_TYPE DIR *
11
#define WRAPPER_RET_TYPE DIR *
12
#define WRAPPER_RET_DEFAULT NULL
12
#define WRAPPER_RET_DEFAULT NULL
13
#define WRAPPER_PRE_CHECKS() sb_opendir_pre_check(STRING_NAME, name)
14
13
#include "__wrapper_simple.c"
15
#include "__wrapper_simple.c"
(-)a/libsandbox/wrapper-funcs/opendir_pre_check.c (+26 lines)
Line 0 Link Here
1
/*
2
 * opendir() pre-check.
3
 *
4
 * Copyright 1999-2016 Gentoo Foundation
5
 * Licensed under the GPL-2
6
 */
7
8
bool sb_opendir_pre_check(const char *func, const char *name)
9
{
10
	/* If length of name is larger than PATH_MAX, we would mess it up
11
	 * before it reaches the open syscall, which would cleanly error out
12
	 * via sandbox as well (actually with much smaller lengths than even
13
	 * PATH_MAX).
14
	 * So error out early in this case, in order to avoid an abort in
15
	 * check_syscall later on, which gets ran for opendir, despite it not
16
	 * being a syscall.
17
	 */
18
	if (strnlen(name, PATH_MAX) == PATH_MAX) {
19
		errno = ENAMETOOLONG;
20
		sb_debug_dyn("EARLY FAIL: %s(%s): %s\n",
21
			func, name, strerror(errno));
22
		return false;
23
	}
24
25
	return true;
26
}
(-)a/libsandbox/wrappers.h (-1 / +1 lines)
Lines 27-32 attribute_hidden bool sb_fopen64_pre_check (const char *func, const char *pathn Link Here
27
attribute_hidden bool sb_mkdirat_pre_check  (const char *func, const char *pathname, int dirfd);
27
attribute_hidden bool sb_mkdirat_pre_check  (const char *func, const char *pathname, int dirfd);
28
attribute_hidden bool sb_openat_pre_check   (const char *func, const char *pathname, int dirfd, int flags);
28
attribute_hidden bool sb_openat_pre_check   (const char *func, const char *pathname, int dirfd, int flags);
29
attribute_hidden bool sb_openat64_pre_check (const char *func, const char *pathname, int dirfd, int flags);
29
attribute_hidden bool sb_openat64_pre_check (const char *func, const char *pathname, int dirfd, int flags);
30
attribute_hidden bool sb_opendir_pre_check  (const char *func, const char *name);
30
attribute_hidden bool sb_unlinkat_pre_check (const char *func, const char *pathname, int dirfd);
31
attribute_hidden bool sb_unlinkat_pre_check (const char *func, const char *pathname, int dirfd);
31
attribute_hidden bool sb_common_at_pre_check(const char *func, const char **pathname, int dirfd,
32
attribute_hidden bool sb_common_at_pre_check(const char *func, const char **pathname, int dirfd,
32
                                             char *dirfd_path, size_t dirfd_path_len);
33
                                             char *dirfd_path, size_t dirfd_path_len);
33
- 

Return to bug 553092