aboutsummaryrefslogtreecommitdiffstats
path: root/g10/import.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-03-15 12:02:44 +0000
committerWerner Koch <[email protected]>2019-03-15 12:03:34 +0000
commitf06b6fe47f56a15ac426665c3d9661d4b104696f (patch)
treecfeb0037e5729a60963fbbed1cb109b124ecbfcb /g10/import.c
parentgpg: Fix recently introduced use after free. (diff)
downloadgnupg-f06b6fe47f56a15ac426665c3d9661d4b104696f.tar.gz
gnupg-f06b6fe47f56a15ac426665c3d9661d4b104696f.zip
gpg: Simplify an interactive import status line.
* g10/cpr.c (write_status_printf): Escape CR and LF. * g10/import.c (print_import_check): Simplify by using write_status_printf and hexfingerprint. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/import.c')
-rw-r--r--g10/import.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/g10/import.c b/g10/import.c
index 25ccc2fc6..25c9a6632 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -1084,23 +1084,14 @@ print_import_ok (PKT_public_key *pk, unsigned int reason)
static void
print_import_check (PKT_public_key * pk, PKT_user_id * id)
{
- char * buf;
- byte fpr[24];
+ byte hexfpr[2*MAX_FINGERPRINT_LEN+1];
u32 keyid[2];
- size_t i, n;
- size_t pos = 0;
- buf = xmalloc (17+41+id->len+32);
keyid_from_pk (pk, keyid);
- sprintf (buf, "%08X%08X ", keyid[0], keyid[1]);
- pos = 17;
- fingerprint_from_pk (pk, fpr, &n);
- for (i = 0; i < n; i++, pos += 2)
- sprintf (buf+pos, "%02X", fpr[i]);
- strcat (buf, " ");
- strcat (buf, id->name);
- write_status_text (STATUS_IMPORT_CHECK, buf);
- xfree (buf);
+ hexfingerprint (pk, hexfpr, sizeof hexfpr);
+ write_status_printf (STATUS_IMPORT_CHECK, "%08X%08X %s %s",
+ keyid[0], keyid[1], hexfpr, id->name);
+
}