summaryrefslogtreecommitdiff
path: root/rpmio/rpmpgp.c
diff options
context:
space:
mode:
authorDemi Marie Obenour <demi@invisiblethingslab.com>2021-08-07 11:43:40 -0400
committerFlorian Festi <ffesti@redhat.com>2022-02-09 16:38:50 +0100
commite32332b8a943676daa184c7a1c87869b80ba923b (patch)
tree6717d2a97a169cd283e62e447885da872a4e57ce /rpmio/rpmpgp.c
parent6aec7c673f25ff8339730cca45207aed0a6e7c42 (diff)
downloadrpm-e32332b8a943676daa184c7a1c87869b80ba923b.tar.gz
Bail out if a key ID cannot be obtained
If a key ID cannot be obtained, the key is useless. This also ensures that pgpPrtKey only needs to handle input that getKeyID has already validated.
Diffstat (limited to 'rpmio/rpmpgp.c')
-rw-r--r--rpmio/rpmpgp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index d1966d322..8f244efed 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -916,11 +916,13 @@ static int pgpPrtPkt(struct pgpPkt *p, pgpDigParams _digp)
break;
case PGPTAG_PUBLIC_KEY:
/* Get the public key Key ID. */
- if (!getKeyID(p->body, p->blen, _digp->signid))
- _digp->saved |= PGPDIG_SAVED_ID;
- else
+ rc = getKeyID(p->body, p->blen, _digp->signid);
+ if (rc)
memset(_digp->signid, 0, sizeof(_digp->signid));
- rc = pgpPrtKey(p->tag, p->body, p->blen, _digp);
+ else {
+ _digp->saved |= PGPDIG_SAVED_ID;
+ rc = pgpPrtKey(p->tag, p->body, p->blen, _digp);
+ }
break;
case PGPTAG_USER_ID:
rc = pgpPrtUserID(p->tag, p->body, p->blen, _digp);