[svn] GnuPG - r4911 - trunk/sm
svn author wk
cvs at cvs.gnupg.org
Thu Jan 8 20:52:00 CET 2009
Author: wk
Date: 2009-01-08 20:51:59 +0100 (Thu, 08 Jan 2009)
New Revision: 4911
Modified:
trunk/sm/ChangeLog
trunk/sm/fingerprint.c
Log:
Fix error detection
Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog 2009-01-08 15:48:51 UTC (rev 4910)
+++ trunk/sm/ChangeLog 2009-01-08 19:51:59 UTC (rev 4911)
@@ -1,3 +1,7 @@
+2009-01-08 Werner Koch <wk at g10code.com>
+
+ * fingerprint.c (gpgsm_get_keygrip_hexstring): Add error detection.
+
2008-12-10 Werner Koch <wk at g10code.com>
* gpgsm.c (our_cipher_test_algo): Use the GCRY constants as we now
Modified: trunk/sm/fingerprint.c
===================================================================
--- trunk/sm/fingerprint.c 2009-01-08 15:48:51 UTC (rev 4910)
+++ trunk/sm/fingerprint.c 2009-01-08 19:51:59 UTC (rev 4911)
@@ -152,9 +152,9 @@
/* Return the so called KEYGRIP which is the SHA-1 hash of the public
- key parameters expressed as an canoncial encoded S-Exp. array must
- be 20 bytes long. returns the array or a newly allocated one if the
- passed one was NULL */
+ key parameters expressed as an canoncial encoded S-Exp. ARRAY must
+ be 20 bytes long. Returns ARRAY or a newly allocated buffer if ARRAY was
+ given as NULL. May return NULL on error. */
unsigned char *
gpgsm_get_keygrip (ksba_cert_t cert, unsigned char *array)
{
@@ -204,9 +204,11 @@
unsigned char grip[20];
char *buf;
- gpgsm_get_keygrip (cert, grip);
- buf = xmalloc (20*2+1);
- bin2hex (grip, 20, buf);
+ if (!gpgsm_get_keygrip (cert, grip))
+ return NULL;
+ buf = xtrymalloc (20*2+1);
+ if (buf)
+ bin2hex (grip, 20, buf);
return buf;
}
More information about the Gnupg-commits
mailing list