1 Star 0 Fork 40

jeff200902/multipath-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
6004-multipath-fix-max-array-size-in-print_cmd_valid.patch 949 Bytes
一键复制 编辑 原始数据 按行查看 历史
wangjufeng 提交于 2020-01-10 17:13 . rename the package
From b25493d8fa13c2d7a346e0b18ad4756aa733ff8d Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:10 -0500
Subject: [PATCH] multipath: fix max array size in print_cmd_valid
The code is attempting to verify that 0 <= k < 3
However, sizeof(val) is 12, assuming 4 byte integers. The check needs to
take integer size into account. Found by coverity.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/multipath/main.c b/multipath/main.c
index fc5bf169..d5aad952 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -482,7 +482,7 @@ static int print_cmd_valid(int k, const vector pathvec,
struct timespec until;
struct path *pp;
- if (k < 0 || k >= sizeof(vals))
+ if (k < 0 || k >= (sizeof(vals) / sizeof(int)))
return 1;
if (k == 2) {
--
2.11.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jeff200902/multipath-tools.git
git@gitee.com:jeff200902/multipath-tools.git
jeff200902
multipath-tools
multipath-tools
master

搜索帮助