Skip to content

Commit

Permalink
Avoid clobbering existing saved time
Browse files Browse the repository at this point in the history
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 rpm-software-management#2004.
  • Loading branch information
DemiMarie authored and pmatilai committed Apr 13, 2022
1 parent 71ec44b commit 2b48aa7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rpmio/rpmpgp_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2b48aa7

Please sign in to comment.