From d55e88d0bc6d669c0e8f3b930113ecba638a6fa3 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 1 Sep 2002 23:08:50 +0000 Subject: [PATCH] 2002-09-02 Marcus Brinkmann * conversion.c (_gpgme_decode_c_string): Fix off by one error in last change. * rungpg.c (_gpgme_append_gpg_args_from_signers): Move before _gpgme_op_edit so its prototype is known early on. --- gpgme/ChangeLog | 4 ++++ gpgme/conversion.c | 2 +- gpgme/rungpg.c | 52 +++++++++++++++++++++++----------------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 65af2a4..9497373 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,5 +1,9 @@ 2002-09-02 Marcus Brinkmann + * conversion.c (_gpgme_decode_c_string): Fix off by one error in last change. + * rungpg.c (_gpgme_append_gpg_args_from_signers): Move before + _gpgme_op_edit so its prototype is known early on. + * conversion.c: New file. * util.h: Add prototypes for _gpgme_decode_c_string and _gpgme_hextobyte. diff --git a/gpgme/conversion.c b/gpgme/conversion.c index 4029db8..9e1737f 100644 --- a/gpgme/conversion.c +++ b/gpgme/conversion.c @@ -58,7 +58,7 @@ _gpgme_decode_c_string (const char *src, char **destp) /* We can malloc a buffer of the same length, because the converted string will never be larger. */ - dest = xtrymalloc (strlen (src)); + dest = xtrymalloc (strlen (src) + 1); if (!dest) return mk_error (Out_Of_Core); diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index e0a4e21..f67f68f 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -1439,6 +1439,32 @@ _gpgme_gpg_op_delete (GpgObject gpg, GpgmeKey key, int allow_secret) } +static GpgmeError +_gpgme_append_gpg_args_from_signers (GpgObject gpg, + GpgmeCtx ctx /* FIXME */) +{ + GpgmeError err = 0; + int i; + GpgmeKey key; + + for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++) + { + const char *s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, + NULL, 0); + if (s) + { + if (!err) + err = _gpgme_gpg_add_arg (gpg, "-u"); + if (!err) + err = _gpgme_gpg_add_arg (gpg, s); + } + gpgme_key_unref (key); + if (err) break; + } + return err; +} + + GpgmeError _gpgme_gpg_op_edit (GpgObject gpg, GpgmeKey key, GpgmeData out, GpgmeCtx ctx /* FIXME */) @@ -1487,32 +1513,6 @@ _gpgme_append_gpg_args_from_recipients (GpgObject gpg, } -static GpgmeError -_gpgme_append_gpg_args_from_signers (GpgObject gpg, - GpgmeCtx ctx /* FIXME */) -{ - GpgmeError err = 0; - int i; - GpgmeKey key; - - for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++) - { - const char *s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, - NULL, 0); - if (s) - { - if (!err) - err = _gpgme_gpg_add_arg (gpg, "-u"); - if (!err) - err = _gpgme_gpg_add_arg (gpg, s); - } - gpgme_key_unref (key); - if (err) break; - } - return err; -} - - GpgmeError _gpgme_gpg_op_encrypt (GpgObject gpg, GpgmeRecipients recp, GpgmeData plain, GpgmeData ciph, int use_armor) -- 2.26.2