summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-03-22 12:24:55 +0200
committerPanu Matilainen <pmatilai@redhat.com>2012-03-22 12:34:08 +0200
commit8a189c638386bee3906033857aa7268c1e0ca22c (patch)
tree99959aa3522acaadaead3a6e2b95e70d7a2a0247 /rpmio
parentc411382194ab678cfe87b20dd2967a51f2bd412e (diff)
downloadlibrpm-tizen-8a189c638386bee3906033857aa7268c1e0ca22c.tar.gz
librpm-tizen-8a189c638386bee3906033857aa7268c1e0ca22c.tar.bz2
librpm-tizen-8a189c638386bee3906033857aa7268c1e0ca22c.zip
Oops, "magic eight" is necessary here afterall
- Fix regression from commit 807b402d95702f3f91e9e2bfbd2b5ca8c9964ed9, the array gets passed as a pointer (how else would it work at all), so despite having seemingly correct type, sizeof(keyid) depends on the pointer size. This happens to be 8 on x86_64 and friends but breaks pgp fingerprint calculation on eg i386. - Also return the explicit size from pgpExtractPubkeyFingerprint(), this has been "broken" for much longer but then all callers should really care about is -1 for error.
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/rpmpgp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index 4aac23d59..e70cf706b 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -757,7 +757,7 @@ static int getFingerprint(const uint8_t *h, size_t hlen, pgpKeyID_t keyid)
(void) rpmDigestFinal(ctx, (void **)&d, &dlen, 0);
if (d) {
- memcpy(keyid, (d + (dlen-sizeof(keyid))), sizeof(keyid));
+ memcpy(keyid, (d + (dlen-8)), 8);
free(d);
rc = 0;
}
@@ -787,7 +787,7 @@ int pgpExtractPubkeyFingerprint(const char * b64pkt, pgpKeyID_t keyid)
if (rpmBase64Decode(b64pkt, (void **)&pkt, &pktlen) == 0) {
if (pgpPubkeyFingerprint(pkt, pktlen, keyid) == 0) {
/* if there ever was a bizarre return code for success... */
- rc = sizeof(keyid);
+ rc = 8;
}
free(pkt);
}