Release v2.29.0 #312
@@ -141,9 +141,9 @@ static FILE* secret_file_open(const char* path, char* err, size_t err_size) {
|
|||||||
* most systems, but explicit. Failures here are ignored: O_NONBLOCK on a
|
* most systems, but explicit. Failures here are ignored: O_NONBLOCK on a
|
||||||
* regular file does not affect reads either way. */
|
* regular file does not affect reads either way. */
|
||||||
if (S_ISREG(st.st_mode)) {
|
if (S_ISREG(st.st_mode)) {
|
||||||
int flags = fcntl(fd, F_GETFL);
|
int status_flags = fcntl(fd, F_GETFL);
|
||||||
if (flags >= 0)
|
if (status_flags >= 0)
|
||||||
(void)fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
|
(void)fcntl(fd, F_SETFL, status_flags & ~O_NONBLOCK);
|
||||||
}
|
}
|
||||||
FILE* fp = fdopen(fd, "r");
|
FILE* fp = fdopen(fd, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
|
|||||||
+2
-4
@@ -411,8 +411,7 @@ static void test_file_open_temp_dir_symlink_confinement() {
|
|||||||
EXPECT_EQ_INT(mkdir(scratch, 0755), 0);
|
EXPECT_EQ_INT(mkdir(scratch, 0755), 0);
|
||||||
int scratch_fd = file_open_temp_dir(scratch);
|
int scratch_fd = file_open_temp_dir(scratch);
|
||||||
EXPECT_TRUE(scratch_fd >= 0);
|
EXPECT_TRUE(scratch_fd >= 0);
|
||||||
if (scratch_fd >= 0)
|
close(scratch_fd);
|
||||||
close(scratch_fd);
|
|
||||||
|
|
||||||
/* A symlink whose target is outside the root is refused. */
|
/* A symlink whose target is outside the root is refused. */
|
||||||
char* escape = path_cat(root_abs, "escape");
|
char* escape = path_cat(root_abs, "escape");
|
||||||
@@ -426,8 +425,7 @@ static void test_file_open_temp_dir_symlink_confinement() {
|
|||||||
EXPECT_EQ_INT(symlink(scratch, inside_link), 0);
|
EXPECT_EQ_INT(symlink(scratch, inside_link), 0);
|
||||||
int link_fd = file_open_temp_dir(inside_link);
|
int link_fd = file_open_temp_dir(inside_link);
|
||||||
EXPECT_TRUE(link_fd >= 0);
|
EXPECT_TRUE(link_fd >= 0);
|
||||||
if (link_fd >= 0)
|
close(link_fd);
|
||||||
close(link_fd);
|
|
||||||
|
|
||||||
free(inside_link);
|
free(inside_link);
|
||||||
free(escape);
|
free(escape);
|
||||||
|
|||||||
Reference in New Issue
Block a user