summaryrefslogtreecommitdiff
path: root/rpmio/rpmkeyring.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-10-25 14:03:43 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-10-25 14:03:43 +0300
commit2544204715c81c3d4c211dcedf35b9371c49b0ab (patch)
treed3942276d5d15f26a05479e59358ed9f9e333a33 /rpmio/rpmkeyring.c
parent965c53bb6c1d9f4d77a23b25a5c02f52edcd8c0a (diff)
downloadlibrpm-tizen-2544204715c81c3d4c211dcedf35b9371c49b0ab.tar.gz
librpm-tizen-2544204715c81c3d4c211dcedf35b9371c49b0ab.tar.bz2
librpm-tizen-2544204715c81c3d4c211dcedf35b9371c49b0ab.zip
pgpPubkeyFingerprint() can fail, propagate errors part II
- rpmPubkeyNew() needs to return NULL if we fail to grab the keyid, make it so...
Diffstat (limited to 'rpmio/rpmkeyring.c')
-rw-r--r--rpmio/rpmkeyring.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/rpmio/rpmkeyring.c b/rpmio/rpmkeyring.c
index 784bc3a48..208e29078 100644
--- a/rpmio/rpmkeyring.c
+++ b/rpmio/rpmkeyring.c
@@ -124,16 +124,20 @@ exit:
rpmPubkey rpmPubkeyNew(const uint8_t *pkt, size_t pktlen)
{
rpmPubkey key = NULL;
+ pgpKeyID_t keyid;
if (pkt == NULL || pktlen == 0)
goto exit;
+ if (pgpPubkeyFingerprint(pkt, pktlen, keyid))
+ goto exit;
+
key = xcalloc(1, sizeof(*key));
- pgpPubkeyFingerprint(pkt, pktlen, key->keyid);
key->pkt = xmalloc(pktlen);
key->pktlen = pktlen;
key->nrefs = 0;
memcpy(key->pkt, pkt, pktlen);
+ memcpy(key->keyid, keyid, sizeof(keyid));
exit:
return rpmPubkeyLink(key);