From c6e2ee020784de63edfa83c76095e086eae49eef Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 4 Dec 2018 15:43:19 +0100 Subject: gpg: Prepare revocation keys for use with v5 keys. * g10/packet.h (struct revocation_key): Add field 'fprlen'. * g10/parse-packet.c (parse_revkeys): Set fprlen and allow for v5 keys. Also fix reading of unitialized data at place where MAX_FINGERPRINT_LEN is used. * g10/revoke.c (gen_desig_revoke): Allow for v5 keys and use fprlen. Do an explicit compare to avoid reading unitialized data. * g10/sig-check.c (check_revocation_keys): Use the fprlen. * g10/getkey.c (merge_selfsigs_main): Do an explicit copy to avoid reading unitialized data. * g10/import.c (revocation_present): Use fprlen. * g10/keyedit.c (show_key_with_all_names): Use fprlen. (menu_addrevoker): Use fprlen. Allow for v5 keys. * g10/keygen.c (keygen_add_revkey): Use fprlen. (parse_revocation_key): Allow for v5 keys. * g10/keyid.c (keyid_from_fingerprint): Allow for v5 keys. Print a better error message in case of bogus fingerprints. * g10/keylist.c (print_revokers): Use fprlen. -- The reading of uninitialized data is harmless but we better fix it to make valgrind happy. More serious was that we always passed MAX_FINGERPRINT_LEN but we will need to support 20 and 32 octet fingerprints and MAX_FINGERPRINT_LEN would be too large for a v4. Signed-off-by: Werner Koch --- g10/keylist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'g10/keylist.c') diff --git a/g10/keylist.c b/g10/keylist.c index 9a2166308..92a8d4cbb 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -1321,7 +1321,7 @@ print_revokers (estream_t fp, PKT_public_key * pk) es_fprintf (fp, "rvk:::%d::::::", pk->revkey[i].algid); p = pk->revkey[i].fpr; - for (j = 0; j < 20; j++, p++) + for (j = 0; j < pk->revkey[i].fprlen; j++, p++) es_fprintf (fp, "%02X", *p); es_fprintf (fp, ":%02x%s:\n", pk->revkey[i].class, -- cgit v1.2.3