1 Star 0 Fork 82

hongjinghao/rpm

forked from src-openEuler/rpm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-a-theoretical-use-of-uninitialized-struct-member.patch 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
hugel 提交于 2024-03-14 09:41 +08:00 . backport some patches from upstream
From 656fe42af1d497c35769c740fcc98950e1455bad Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 24 Jan 2024 12:44:34 +0200
Subject: [PATCH] Fix a theoretical use of uninitialized struct members
If rpmScriptFromTriggerTag() was called with tm other than the three
handled cases in the switch, the rpmtd_s structs would be uninitialized
and weird things could happen. The value of tm is hardwired in all the
existing callers AFAICS but the extra safety doesn't hurt either.
Discovered by static analysis in RHEL.
---
lib/rpmscript.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
index b18f851a3..3f6313278 100644
--- a/lib/rpmscript.c
+++ b/lib/rpmscript.c
@@ -641,6 +641,8 @@ rpmScript rpmScriptFromTriggerTag(Header h, rpmTagVal triggerTag,
headerGet(h, RPMTAG_TRANSFILETRIGGERSCRIPTFLAGS, &tflags, hgflags);
prefix = "transfile";
break;
+ default:
+ return NULL;
}
if (rpmtdSetIndex(&tscripts, ix) >= 0 && rpmtdSetIndex(&tprogs, ix) >= 0) {
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hongjinghao/rpm.git
git@gitee.com:hongjinghao/rpm.git
hongjinghao
rpm
rpm
master

搜索帮助

371d5123 14472233 46e8bd33 14472233