diff options
author | Werner Koch <wk@gnupg.org> | 2019-05-21 17:27:42 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2019-05-21 17:27:42 +0200 |
commit | 4c7d63cd5b02ebfd09933bebd1312e01958b3e20 (patch) | |
tree | cfc00bbea0c4069e33069e5cee83b383f6a6eb9f /g10/keydb.c | |
parent | gpg: Do not allow creation of user ids larger than our parser allows. (diff) | |
download | gnupg2-4c7d63cd5b02ebfd09933bebd1312e01958b3e20.tar.xz gnupg2-4c7d63cd5b02ebfd09933bebd1312e01958b3e20.zip |
gpg: Do not bail on an invalid packet in the local keyring.
* g10/keydb.c (parse_keyblock_image): Treat invalid packet special.
--
This is in particular useful to run --list-keys on a keyring with
corrupted packets. The extra flush is to keep the diagnostic close to
the regular --list-key output.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/keydb.c')
-rw-r--r-- | g10/keydb.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/g10/keydb.c b/g10/keydb.c index 45eb4aa34..a7691bbe2 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -1242,8 +1242,15 @@ parse_keyblock_image (iobuf_t iobuf, int pk_no, int uid_no, } if (err) { + es_fflush (es_stdout); log_error ("parse_keyblock_image: read error: %s\n", gpg_strerror (err)); + if (gpg_err_code (err) == GPG_ERR_INV_PACKET) + { + free_packet (pkt, &parsectx); + init_packet (pkt); + continue; + } err = gpg_error (GPG_ERR_INV_KEYRING); break; } |