1 Star 0 Fork 126

YIN JIAYI/qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
slirp-tftp-restrict-relative-path-access.patch 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
Ying Fang 提交于 2020-05-15 16:51 . CVE: Fix CVE-2020-7211
From 2fc07f4ce31a2cc9973cfb1c20897c6a4babd8b8 Mon Sep 17 00:00:00 2001
From: Prasad J Pandit <[email protected]>
Date: Fri, 15 May 2020 16:45:28 +0800
Subject: [PATCH] slirp: tftp: restrict relative path access
tftp restricts relative or directory path access on Linux systems.
Apply same restrictions on Windows systems too. It helps to avoid
directory traversal issue.
Fixes: https://bugs.launchpad.net/qemu/+bug/1812451Reported-by: default avatarPeter Maydell <[email protected]>
Signed-off-by: default avatarPrasad J Pandit <[email protected]>
Reviewed-by: Samuel Thibault's avatarSamuel Thibault <[email protected]>
Message-Id: <[email protected]>
diff --git a/slirp/src/tftp.c b/slirp/src/tftp.c
index 093c2e06..2b4176cc 100644
--- a/slirp/src/tftp.c
+++ b/slirp/src/tftp.c
@@ -344,8 +344,13 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockaddr_storage *srcsas,
k += 6; /* skipping octet */
/* do sanity checks on the filename */
- if (!strncmp(req_fname, "../", 3) ||
- req_fname[strlen(req_fname) - 1] == '/' || strstr(req_fname, "/../")) {
+ if (
+#ifdef G_OS_WIN32
+ strstr(req_fname, "..\\") ||
+ req_fname[strlen(req_fname) - 1] == '\\' ||
+#endif
+ strstr(req_fname, "../") ||
+ req_fname[strlen(req_fname) -1] == '/') {
tftp_send_error(spt, 2, "Access violation", tp);
return;
}
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yinjiayi/qemu123.git
[email protected]:yinjiayi/qemu123.git
yinjiayi
qemu123
qemu
openEuler-20.03-LTS

搜索帮助