summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemi Marie Obenour <demi@invisiblethingslab.com>2022-02-03 20:42:02 -0500
committerMichal Domonkos <mdomonko@redhat.com>2022-07-01 10:52:14 +0200
commitcc6e621bdb509edcf595132913630b7fa528ef29 (patch)
tree7cd9e872f2e1ab5b375c6aeb7d600cc72cddb93d
parenta63276efdafcb2ddc513f9c33ad0671a73f6c855 (diff)
downloadrpm-cc6e621bdb509edcf595132913630b7fa528ef29.tar.gz
Check that the CRC length is correct
Also fix a memory leak in an error path. (cherry picked from commit 1f03aba8b2881a5717af97065038fb056e02a2b3)
-rw-r--r--rpmio/rpmpgp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index c3da46cb2..646332252 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -1454,7 +1454,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;
}