diff options
author | Demi Marie Obenour <demi@invisiblethingslab.com> | 2022-04-12 07:59:21 -0400 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2022-04-13 10:56:58 +0300 |
commit | b3118404cd0cc00fef2597000e9cfd73bb5ea7a8 (patch) | |
tree | e6924cf98152fe05abebf24d9728f546a63b6853 | |
parent | 3c64a599f68ec40dcfaf6338e45cc8d4984039c7 (diff) | |
download | rpm-b3118404cd0cc00fef2597000e9cfd73bb5ea7a8.tar.gz |
Avoid clobbering existing saved time
The public key parser needs to set PGPDIG_SAVED_TIME, so that future
iterations in pgpDigParams() do not clobber the key’s creation time.
Fixes #2004.
(backported from commit 2b48aa7c69e530a70fc1a2620375c23b8eef1f4c)
-rw-r--r-- | rpmio/rpmpgp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index 3d773d2f7..deea65eae 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -825,8 +825,10 @@ static int pgpPrtKey(pgpTag tag, const uint8_t *h, size_t hlen, /* If _digp->hash is not NULL then signature is already loaded */ if (_digp->hash == NULL) { _digp->version = v->version; - _digp->time = pgpGrab(v->time, sizeof(v->time)); + if (!(_digp->saved & PGPDIG_SAVED_TIME)) + _digp->time = pgpGrab(v->time, sizeof(v->time)); _digp->pubkey_algo = v->pubkey_algo; + _digp->saved |= PGPDIG_SAVED_TIME | PGPDIG_SIG_HAS_CREATION_TIME; } p = ((uint8_t *)v) + sizeof(*v); |