summaryrefslogtreecommitdiff
path: root/backport-Fix-hash-context-leak.patch
diff options
context:
space:
mode:
Diffstat (limited to 'backport-Fix-hash-context-leak.patch')
-rw-r--r--backport-Fix-hash-context-leak.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/backport-Fix-hash-context-leak.patch b/backport-Fix-hash-context-leak.patch
new file mode 100644
index 0000000..f8fda68
--- /dev/null
+++ b/backport-Fix-hash-context-leak.patch
@@ -0,0 +1,34 @@
+From 6e9531430d70fe80b67782ed57f1526aec9ed711 Mon Sep 17 00:00:00 2001
+From: Justus Winter <justus@sequoia-pgp.org>
+Date: Thu, 28 Oct 2021 13:32:22 +0200
+Subject: [PATCH] Fix hash context leak
+
+The hash context is duplicated unconditionally, but there is an
+execution path exiting the function without it being finalized.
+---
+ rpmio/rpmpgp.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
+index 861f670..1e4f667 100644
+--- a/rpmio/rpmpgp.c
++++ b/rpmio/rpmpgp.c
+@@ -1310,6 +1310,7 @@ rpmRC pgpVerifySignature(pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx)
+ }
+
+ rpmDigestFinal(ctx, (void **)&hash, &hashlen, 0);
++ ctx = NULL;
+
+ /* Compare leading 16 bits of digest for quick check. */
+ if (hash == NULL || memcmp(hash, sig->signhash16, 2) != 0)
+@@ -1333,6 +1334,7 @@ rpmRC pgpVerifySignature(pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx)
+
+ exit:
+ free(hash);
++ rpmDigestFinal(ctx, NULL, NULL, 0);
+ return res;
+
+ }
+--
+1.8.3.1
+