diff options
Diffstat (limited to 'meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch')
-rw-r--r-- | meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch b/meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch new file mode 100644 index 0000000000..044b4dd2a0 --- /dev/null +++ b/meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From 9a6871126f472feea057d5f803505ec8cc78f083 Mon Sep 17 00:00:00 2001 | ||
2 | From: Panu Matilainen <pmatilai@redhat.com> | ||
3 | Date: Thu, 30 Sep 2021 09:56:20 +0300 | ||
4 | Subject: [PATCH 1/3] Refactor pgpDigParams construction to helper function | ||
5 | |||
6 | No functional changes, just to reduce code duplication and needed by | ||
7 | the following commits. | ||
8 | |||
9 | CVE: CVE-2021-3521 | ||
10 | Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/9f03f42e2] | ||
11 | |||
12 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
13 | --- | ||
14 | rpmio/rpmpgp.c | 13 +++++++++---- | ||
15 | 1 file changed, 9 insertions(+), 4 deletions(-) | ||
16 | |||
17 | diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c | ||
18 | index d0688ebe9a..e472b5320f 100644 | ||
19 | --- a/rpmio/rpmpgp.c | ||
20 | +++ b/rpmio/rpmpgp.c | ||
21 | @@ -1041,6 +1041,13 @@ unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype) | ||
22 | return algo; | ||
23 | } | ||
24 | |||
25 | +static pgpDigParams pgpDigParamsNew(uint8_t tag) | ||
26 | +{ | ||
27 | + pgpDigParams digp = xcalloc(1, sizeof(*digp)); | ||
28 | + digp->tag = tag; | ||
29 | + return digp; | ||
30 | +} | ||
31 | + | ||
32 | int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, | ||
33 | pgpDigParams * ret) | ||
34 | { | ||
35 | @@ -1058,8 +1065,7 @@ int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, | ||
36 | if (pkttype && pkt.tag != pkttype) { | ||
37 | break; | ||
38 | } else { | ||
39 | - digp = xcalloc(1, sizeof(*digp)); | ||
40 | - digp->tag = pkt.tag; | ||
41 | + digp = pgpDigParamsNew(pkt.tag); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | @@ -1105,8 +1111,7 @@ int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen, | ||
46 | digps = xrealloc(digps, alloced * sizeof(*digps)); | ||
47 | } | ||
48 | |||
49 | - digps[count] = xcalloc(1, sizeof(**digps)); | ||
50 | - digps[count]->tag = PGPTAG_PUBLIC_SUBKEY; | ||
51 | + digps[count] = pgpDigParamsNew(PGPTAG_PUBLIC_SUBKEY); | ||
52 | /* Copy UID from main key to subkey */ | ||
53 | digps[count]->userid = xstrdup(mainkey->userid); | ||
54 | |||
55 | -- | ||
56 | 2.17.1 | ||
57 | |||