diff options
author | Demi Marie Obenour <demi@invisiblethingslab.com> | 2022-04-12 07:59:21 -0400 |
---|---|---|
committer | Michal Domonkos <mdomonko@redhat.com> | 2022-07-01 10:52:14 +0200 |
commit | 820a90ac623989ea7491f16d6844acf68cf2d086 (patch) | |
tree | 5fc83a3fee73b861268571cb1f6c8a4e8eeaf06b | |
parent | 1c16ac8e1a732619f0f9cfb9f0076010d1174219 (diff) | |
download | rpm-820a90ac623989ea7491f16d6844acf68cf2d086.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 300540399..ba726af00 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -805,8 +805,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); |