代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 0dbf69ccdfa7b1f99935c3932445fbfa16dbbe75 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <[email protected]>
Date: Mon, 8 Apr 2019 14:15:10 +0900
Subject: [PATCH] fileio: read_full_file_full() also warns when file is world
readable and secure flag is set
(cherry picked from commit 65dcd394d8223bc6bc194f3fe5bd70fed9d9a4fe)
Signed-off-by: Guorui Yu <[email protected]>
---
src/basic/fileio.c | 6 +++++-
src/basic/fileio.h | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 2e74aac554..3abeb0d7f4 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -386,6 +386,7 @@ int read_full_virtual_file(const char *filename, char **ret_contents, size_t *re
int read_full_stream_full(
FILE *f,
+ const char *filename,
ReadFullFileFlags flags,
char **ret_contents,
size_t *ret_size) {
@@ -418,6 +419,9 @@ int read_full_stream_full(
* makes us notice the EOF. */
if (st.st_size > 0)
n_next = st.st_size + 1;
+
+ if (flags & READ_FULL_FILE_SECURE)
+ (void) warn_file_is_world_accessible(filename, &st, NULL, 0);
}
}
@@ -508,7 +512,7 @@ int read_full_file_full(const char *filename, ReadFullFileFlags flags, char **co
(void) __fsetlocking(f, FSETLOCKING_BYCALLER);
- return read_full_stream_full(f, flags, contents, size);
+ return read_full_stream_full(f, filename, flags, contents, size);
}
static int parse_env_file_internal(
diff --git a/src/basic/fileio.h b/src/basic/fileio.h
index 2c9ce4355b..3e572dc0de 100644
--- a/src/basic/fileio.h
+++ b/src/basic/fileio.h
@@ -45,9 +45,9 @@ int read_full_file_full(const char *filename, ReadFullFileFlags flags, char **co
static inline int read_full_file(const char *filename, char **contents, size_t *size) {
return read_full_file_full(filename, 0, contents, size);
}
-int read_full_stream_full(FILE *f, ReadFullFileFlags flags, char **contents, size_t *size);
+int read_full_stream_full(FILE *f, const char *filename, ReadFullFileFlags flags, char **contents, size_t *size);
static inline int read_full_stream(FILE *f, char **contents, size_t *size) {
- return read_full_stream_full(f, 0, contents, size);
+ return read_full_stream_full(f, NULL, 0, contents, size);
}
int read_full_virtual_file(const char *filename, char **ret_contents, size_t *ret_size);
--
2.39.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。