summaryrefslogtreecommitdiff
path: root/rpmio/rpmpgp.c
diff options
context:
space:
mode:
authorDemi Marie Obenour <demi@invisiblethingslab.com>2022-02-03 20:42:02 -0500
committerPanu Matilainen <pmatilai@redhat.com>2022-02-07 15:55:26 +0200
commit1f03aba8b2881a5717af97065038fb056e02a2b3 (patch)
treee790c004f02fc376220f0cd7b6d396fa2a06d310 /rpmio/rpmpgp.c
parent2a8d89a1c390e6ca1de0ece49aa11012b1d0ff89 (diff)
downloadrpm-1f03aba8b2881a5717af97065038fb056e02a2b3.tar.gz
Check that the CRC length is correct
Also fix a memory leak in an error path.
Diffstat (limited to 'rpmio/rpmpgp.c')
-rw-r--r--rpmio/rpmpgp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index 015c15a5c..d1966d322 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -1444,7 +1444,8 @@ static pgpArmor decodePkts(uint8_t *b, uint8_t **pkt, size_t *pktlen)
crcdec = NULL;
crclen = 0;
- if (rpmBase64Decode(crcenc, (void **)&crcdec, &crclen) != 0) {
+ if (rpmBase64Decode(crcenc, (void **)&crcdec, &crclen) != 0 || crclen != 3) {
+ crcdec = _free(crcdec);
ec = PGPARMOR_ERR_CRC_DECODE;
goto exit;
}