Home GnuPG
Diffusion GnuPG e57954ed278c

g10: Fix double free when locating by mbox

Description

g10: Fix double free when locating by mbox

* g10/getkey.c (get_best_pubkey_byname): Set new.uid always
to NULL after use.

pubkey_cmp is not guranteed to set new.uid.
So if the diff < 0 case is reached best is set to new.

If then diff > 0 is reached without modifying new.uid
e.g. if the key has no matching mboxes. new.uid is
free'd even though the uid is still referenced in
best.

Details

Provenance
aheineckeAuthored on Apr 18 2019, 1:19 PM
Parents
rGa861f9343d6e: g10: Fix a memory leak.
Branches
Unknown
Tags
Unknown
Tasks
T4462: GnuPG: Segfaults trying to encrypt / locate by mbox for specific keys