From: Panu Matilainen Date: Tue, 25 Oct 2011 11:03:43 +0000 (+0300) Subject: pgpPubkeyFingerprint() can fail, propagate errors part II X-Git-Tag: rpm-4.10.0-beta1~270 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2544204715c81c3d4c211dcedf35b9371c49b0ab;p=platform%2Fupstream%2Frpm.git pgpPubkeyFingerprint() can fail, propagate errors part II - rpmPubkeyNew() needs to return NULL if we fail to grab the keyid, make it so... --- diff --git a/rpmio/rpmkeyring.c b/rpmio/rpmkeyring.c index 784bc3a..208e290 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);