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 #2004.

(backported from commit 2b48aa7)
  • Loading branch information
DemiMarie authored and pmatilai committed Apr 13, 2022
1 parent 3c64a59 commit b311840
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rpmio/rpmpgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b311840

Please sign in to comment.