[PATCH] fix keystrlen when no keyid-format option has been given

Neal H. Walfield neal at walfield.org
Wed Jan 6 11:19:52 CET 2016


Hi Daniel,

Sorry for the delayed response.

On Wed, 09 Dec 2015 19:01:04 +0100,
Daniel Kahn Gillmor wrote:
> * g10/keyid.c (keystrlen): if opt.keyid_format has not been set,
>   default to 0xLONG, as is done in format_keyid.
> 
> --
> Without this fix, gpgv2 fails with:
> 
> gpgv: Ohhhh jeeee: ... this is a bug (keyid.c:342:keystrlen)
> 
> Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
> ---
>  g10/keyid.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/g10/keyid.c b/g10/keyid.c
> index cb237ef..bb5c7b9 100644
> --- a/g10/keyid.c
> +++ b/g10/keyid.c
> @@ -324,7 +324,11 @@ format_keyid (u32 *keyid, int format, char *buffer, int len)
>  size_t
>  keystrlen(void)
>  {
> -  switch(opt.keyid_format)
> +  int format = opt.keyid_format;
> +  if (format == KF_DEFAULT)
> +    format = KF_0xLONG;
> +
> +  switch(format)
>      {
>      case KF_SHORT:
>        return 8;

Do we want to change the default to 0xLONG?  Currently, gpg defaults
to SHORT.  I realized in format_keyid I have:

  if (format == KF_DEFAULT)
    format = KF_0xLONG;

But, at least for gpg, that is dead code and should probably be
KF_SHORT to reflect the actual behavior.

Thanks,

:) Neal



More information about the Gnupg-devel mailing list