From 27fccc3f01f993165fa1bda5fa8f6866f8bc6b29 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 6 Mar 2008 14:54:11 +0000 Subject: [PATCH] 2008-03-06 Marcus Brinkmann * key.c (_gpgme_key_add_sig): Terminate UID in case SRC is NULL. Reported by Marc Mutz. --- gpgme/ChangeLog | 5 +++++ gpgme/key.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 8285ff85..a27204c6 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2008-03-06 Marcus Brinkmann + + * key.c (_gpgme_key_add_sig): Terminate UID in case SRC is NULL. + Reported by Marc Mutz. + 2008-03-05 Marcus Brinkmann * decrypt.c (release_op_data): Release OPD->result.recipients. diff --git a/gpgme/key.c b/gpgme/key.c index 3dde670f..c9f48f87 100644 --- a/gpgme/key.c +++ b/gpgme/key.c @@ -252,7 +252,7 @@ _gpgme_key_add_sig (gpgme_key_t key, char *src) assert (uid); /* XXX */ /* We can malloc a buffer of the same length, because the converted - string will never be larger. Actually we allocate it twice the + string will never be larger. Actually we allocate it twice the size, so that we are able to store the parsed stuff there too. */ sig = malloc (sizeof (*sig) + 2 * src_len + 3); if (!sig) @@ -275,6 +275,8 @@ _gpgme_key_add_sig (gpgme_key_t key, char *src) parse_user_id (sig->uid, &sig->name, &sig->email, &sig->comment, dst); } + else + sig->uid = '\0'; if (!uid->signatures) uid->signatures = sig;