代码拉取完成,页面将自动刷新
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;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。