From a8dfea6457d12e92783aeb091ae5cd472cbe0c54 Mon Sep 17 00:00:00 2001 From: Moritz Schulte Date: Sun, 8 Aug 2004 22:39:30 +0000 Subject: [PATCH] 2004-08-09 Moritz Schulte * findkey.c (modify_description): Accept description being NULL. --- agent/ChangeLog | 4 ++++ agent/findkey.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/agent/ChangeLog b/agent/ChangeLog index 67da75962..517d7ccdf 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,7 @@ +2004-08-09 Moritz Schulte + + * findkey.c (modify_description): Accept description being NULL. + 2004-08-07 Moritz Schulte * command-ssh.c (ssh_key_to_sexp_buffer): New argument: comment; diff --git a/agent/findkey.c b/agent/findkey.c index e57a5c6c5..cab3691e7 100644 --- a/agent/findkey.c +++ b/agent/findkey.c @@ -143,13 +143,19 @@ modify_description (const char *description, const char *comment, size_t comment_length, char **description_modified) { - size_t description_length = strlen (description); + size_t description_length = description ? strlen (description) : 0; size_t description_new_length = description_length; gpg_error_t err = GPG_ERR_NO_ERROR; char *description_new = NULL; unsigned int i = 0, j = 0; unsigned int special = 0; + if (! description) + { + *description_modified = NULL; + return err; + } + /* Calculate length. */ for (i = 0; i < description_length; i++) {