10 Star 0 Fork 12

src-openEuler/crun

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-tighten-check-in-check_fd_under_path.patch 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxingrong 提交于 2024-07-19 16:32 . add some upstream patchs
From f6f92b872352e7ee29d7e91552150712437bf808 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Sj=C3=B6lund?= <erik.sjolund@gmail.com>
Date: Sat, 26 Aug 2023 11:18:00 +0200
Subject: [PATCH] utils: tighten check in check_fd_under_path()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Giuseppe Scrivano <giuseppe@scrivano.org>
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
---
src/libcrun/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libcrun/utils.c b/src/libcrun/utils.c
index ce0844481..1b7104a4b 100644
--- a/src/libcrun/utils.c
+++ b/src/libcrun/utils.c
@@ -333,7 +333,7 @@ check_fd_under_path (const char *rootfs, size_t rootfslen, int fd, const char *f
if (UNLIKELY (ret < 0))
return crun_make_error (err, errno, "readlink `%s`", fdname);
- if (((size_t) ret) <= rootfslen || memcmp (link, rootfs, rootfslen) != 0)
+ if (((size_t) ret) <= rootfslen || memcmp (link, rootfs, rootfslen) != 0 || link[rootfslen] != '/')
return crun_make_error (err, 0, "target `%s` not under the directory `%s`", fdname, rootfs);
return 0;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/crun.git
git@gitee.com:src-openeuler/crun.git
src-openeuler
crun
crun
master

搜索帮助