[svn] GnuPG - r4931 - trunk/g10

svn author wk cvs at cvs.gnupg.org
Tue Feb 24 12:47:26 CET 2009


Author: wk
Date: 2009-02-24 12:47:25 +0100 (Tue, 24 Feb 2009)
New Revision: 4931

Modified:
   trunk/g10/ChangeLog
   trunk/g10/pkglue.c
Log:
Replace a call to BUG by an error return.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2009-02-19 16:19:16 UTC (rev 4930)
+++ trunk/g10/ChangeLog	2009-02-24 11:47:25 UTC (rev 4931)
@@ -1,3 +1,8 @@
+2009-02-24  Werner Koch  <wk at g10code.com>
+
+	* pkglue.c (pk_verify): Return an error for improper DATA instead
+	of calling BUG().
+
 2009-02-09  Werner Koch  <wk at g10code.com>
 
 	* keylist.c (print_capabilities): Take care of cert-only keys.

Modified: trunk/g10/pkglue.c
===================================================================
--- trunk/g10/pkglue.c	2009-02-19 16:19:16 UTC (rev 4930)
+++ trunk/g10/pkglue.c	2009-02-24 11:47:25 UTC (rev 4931)
@@ -134,13 +134,14 @@
     return GPG_ERR_PUBKEY_ALGO;
 
   if (rc)
-    BUG ();
+    BUG ();  /* gcry_sexp_build should never fail.  */
 
   /* put hash into a S-Exp s_hash */
   if (gcry_sexp_build (&s_hash, NULL, "%m", hash))
-    BUG ();
+    BUG (); /* gcry_sexp_build should never fail.  */
 
-  /* put data into a S-Exp s_sig */
+  /* Put data into a S-Exp s_sig. */
+  s_sig = NULL;
   if (algo == GCRY_PK_DSA)
     {
       if (!data[0] || !data[1])
@@ -167,11 +168,9 @@
   else
     BUG ();
 
-  if (rc)
-    BUG ();
+  if (!rc)
+    rc = gcry_pk_verify (s_sig, s_hash, s_pkey);
 
-
-  rc = gcry_pk_verify (s_sig, s_hash, s_pkey);
   gcry_sexp_release (s_sig);
   gcry_sexp_release (s_hash);
   gcry_sexp_release (s_pkey);




More information about the Gnupg-commits mailing list