32 lines
1.0 KiB
Diff
32 lines
1.0 KiB
Diff
|
|
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
|
||
|
|
|