Skip to content

Commit

Permalink
Fix segfault for subkeys when the main key has no userid
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Apr 2, 2024
1 parent 742db6a commit 31c2f3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rpmpgp_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen,

digps[count] = pgpDigParamsNew(PGPTAG_PUBLIC_SUBKEY);
/* Copy UID from main key to subkey */
digps[count]->userid = xstrdup(mainkey->userid);
digps[count]->userid = mainkey->userid ? xstrdup(mainkey->userid) : NULL;

if (getKeyID(pkt.body, pkt.blen, digps[count]->signid)) {
pgpDigParamsFree(digps[count]);
Expand Down

0 comments on commit 31c2f3d

Please sign in to comment.