Panu Matilainen 6c83a2
From a3d11f7a53811e42cbe36a91a1583a723c2fe108 Mon Sep 17 00:00:00 2001
Panu Matilainen 6c83a2
Message-Id: <a3d11f7a53811e42cbe36a91a1583a723c2fe108.1670413818.git.pmatilai@redhat.com>
Panu Matilainen 6c83a2
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 6c83a2
Date: Mon, 6 Jun 2022 12:04:15 +0300
Panu Matilainen 6c83a2
Subject: [PATCH] Fix potential uninitialized variable use in
Panu Matilainen 6c83a2
 rpmtsImportPubkey()
Panu Matilainen 6c83a2
Panu Matilainen 6c83a2
Commit d703160334ff545ce8bf7475da5689422f43dacc introduced a new step
Panu Matilainen 6c83a2
to key import which can fail before keyring is initialized.
Panu Matilainen 6c83a2
Panu Matilainen 6c83a2
Always initialize your variables, never need "fixes" like this.
Panu Matilainen 6c83a2
---
Panu Matilainen 6c83a2
 lib/rpmts.c | 2 +-
Panu Matilainen 6c83a2
 1 file changed, 1 insertion(+), 1 deletion(-)
Panu Matilainen 6c83a2
Panu Matilainen 6c83a2
diff --git a/lib/rpmts.c b/lib/rpmts.c
Panu Matilainen 6c83a2
index 0b6b7ac6b..b1c80b9c8 100644
Panu Matilainen 6c83a2
--- a/lib/rpmts.c
Panu Matilainen 6c83a2
+++ b/lib/rpmts.c
Panu Matilainen 6c83a2
@@ -609,7 +609,7 @@ rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, size_t pktlen
Panu Matilainen 6c83a2
     rpmPubkey *subkeys = NULL;
Panu Matilainen 6c83a2
     int subkeysCount = 0;
Panu Matilainen 6c83a2
     rpmVSFlags oflags = rpmtsVSFlags(ts);
Panu Matilainen 6c83a2
-    rpmKeyring keyring;
Panu Matilainen 6c83a2
+    rpmKeyring keyring = NULL;
Panu Matilainen 6c83a2
     rpmtxn txn = rpmtxnBegin(ts, RPMTXN_WRITE);
Panu Matilainen 6c83a2
     int krc, i;
Panu Matilainen 6c83a2
 
Panu Matilainen 6c83a2
-- 
Panu Matilainen 6c83a2
2.38.1
Panu Matilainen 6c83a2