summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm/files/CVE-2021-3521-03.patch
blob: fd31f11beb4cf8f4f4ac74c33475f7da598fbcdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 5ff86764b17f31535cb247543a90dd739076ec38 Mon Sep 17 00:00:00 2001
From: Demi Marie Obenour <demi@invisiblethingslab.com>
Date: Thu, 6 May 2021 18:34:45 -0400
Subject: [PATCH] Do not allow extra packets to follow a signature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

According to RFC 4880 § 11.4, a detached signature is “simply a
Signature packet”.  Therefore, extra packets following a detached
signature are not allowed.

Dependent patch:
CVE: CVE-2021-3521
Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/5ff86764b17f31535cb247543a90dd739076ec38]
Signed-off-by: Riyaz Khan <Riyaz.Khan@kpit.com>

---
 rpmio/rpmpgp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index f1a99e7169..5b346a8253 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -1068,6 +1068,8 @@ int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype,
 	    break;
 
 	p += (pkt.body - pkt.head) + pkt.blen;
+	if (pkttype == PGPTAG_SIGNATURE)
+	    break;
     }
 
     rc = (digp && (p == pend)) ? 0 : -1;