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

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Dec 9 19:01:04 CET 2015


* 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;
-- 
2.6.2




More information about the Gnupg-devel mailing list