diff options
author | khorben <khorben@pkgsrc.org> | 2017-02-20 01:09:11 +0000 |
---|---|---|
committer | khorben <khorben@pkgsrc.org> | 2017-02-20 01:09:11 +0000 |
commit | 7c45b71186dc87dce6a55c2b58c86337f03480c9 (patch) | |
tree | 5237e6c28a66f50d2663cda80576c450105d41ff /security/netpgp/patches/patch-src_lib_keyring.c | |
parent | 5d2018ab9076c7774aec9f24ebd4f2a38dd55cad (diff) | |
download | pkgsrc-7c45b71186dc87dce6a55c2b58c86337f03480c9.tar.gz |
Do not crash when listing keys without a keyring
Bumps PKGREVISION.
Diffstat (limited to 'security/netpgp/patches/patch-src_lib_keyring.c')
-rw-r--r-- | security/netpgp/patches/patch-src_lib_keyring.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/security/netpgp/patches/patch-src_lib_keyring.c b/security/netpgp/patches/patch-src_lib_keyring.c new file mode 100644 index 00000000000..5e8407b1fef --- /dev/null +++ b/security/netpgp/patches/patch-src_lib_keyring.c @@ -0,0 +1,21 @@ +$NetBSD: patch-src_lib_keyring.c,v 1.1 2017/02/20 01:09:11 khorben Exp $ + +Do not crash when listing keys without a keyring + +--- src/lib/keyring.c.orig 2017-02-20 01:03:25.000000000 +0000 ++++ src/lib/keyring.c +@@ -993,9 +993,12 @@ pgp_keyring_list(pgp_io_t *io, const pgp + { + pgp_key_t *key; + unsigned n; ++ unsigned keyc = (keyring != NULL) ? keyring->keyc : 0; + +- (void) fprintf(io->res, "%u key%s\n", keyring->keyc, +- (keyring->keyc == 1) ? "" : "s"); ++ (void) fprintf(io->res, "%u key%s\n", keyc, (keyc == 1) ? "" : "s"); ++ if (keyring == NULL) { ++ return 1; ++ } + for (n = 0, key = keyring->keys; n < keyring->keyc; ++n, ++key) { + if (pgp_is_key_secret(key)) { + pgp_print_keydata(io, keyring, key, "sec", |