teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame 0001-Fix-potential-use-of-uninitialized-pipe-array.patch

Michal Domonkos e0ff81
From bff65aad8af719542c7b0c6429e09223c014a909 Mon Sep 17 00:00:00 2001
Michal Domonkos e0ff81
From: Michal Domonkos <mdomonko@redhat.com>
Michal Domonkos e0ff81
Date: Thu, 6 Jun 2024 09:15:02 +0200
Michal Domonkos e0ff81
Subject: [PATCH] Fix potential use of uninitialized pipe array
Michal Domonkos e0ff81
Michal Domonkos e0ff81
We only call pipe(2) after the script is written to disk so if the
Michal Domonkos e0ff81
latter fails, the array will be left uninitialized and subsequently read
Michal Domonkos e0ff81
after skipping to the exit label.  Fix by initializing it.
Michal Domonkos e0ff81
Michal Domonkos e0ff81
Found by Coverity.
Michal Domonkos e0ff81
Michal Domonkos e0ff81
Fixes: RHEL-22604
Michal Domonkos e0ff81
---
Michal Domonkos e0ff81
 lib/rpmscript.c | 2 +-
Michal Domonkos e0ff81
 1 file changed, 1 insertion(+), 1 deletion(-)
Michal Domonkos e0ff81
Michal Domonkos e0ff81
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
Michal Domonkos e0ff81
index 281c55c53..1de4acf8e 100644
Michal Domonkos e0ff81
--- a/lib/rpmscript.c
Michal Domonkos e0ff81
+++ b/lib/rpmscript.c
Michal Domonkos e0ff81
@@ -316,7 +316,7 @@ static rpmRC runExtScript(rpmPlugins plugins, ARGV_const_t prefixes,
Michal Domonkos e0ff81
     char * fn = NULL;
Michal Domonkos e0ff81
     pid_t pid, reaped;
Michal Domonkos e0ff81
     int status;
Michal Domonkos e0ff81
-    int inpipe[2];
Michal Domonkos e0ff81
+    int inpipe[2] = { -1, -1 };
Michal Domonkos e0ff81
     FILE *in = NULL;
Michal Domonkos e0ff81
     const char *line;
Michal Domonkos e0ff81
     char *mline = NULL;
Michal Domonkos e0ff81
-- 
Michal Domonkos e0ff81
2.45.2
Michal Domonkos e0ff81