From 2b48aa7c69e530a70fc1a2620375c23b8eef1f4c Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Tue, 12 Apr 2022 07:59:21 -0400 Subject: [PATCH] Avoid clobbering existing saved time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- rpmio/rpmpgp_internal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpmio/rpmpgp_internal.c b/rpmio/rpmpgp_internal.c index a4edefc8bd..9c69f12838 100644 --- a/rpmio/rpmpgp_internal.c +++ b/rpmio/rpmpgp_internal.c @@ -620,8 +620,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);