[svn] GnuPG - r5022 - trunk/g10

svn author wk cvs at cvs.gnupg.org
Tue May 26 11:29:03 CEST 2009


Author: wk
Date: 2009-05-26 11:29:02 +0200 (Tue, 26 May 2009)
New Revision: 5022

Modified:
   trunk/g10/ChangeLog
   trunk/g10/parse-packet.c
   trunk/g10/signal.c
Log:
Fix a signal cleanup problem.
Fix zero length MPI reading.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2009-05-22 15:38:49 UTC (rev 5021)
+++ trunk/g10/ChangeLog	2009-05-26 09:29:02 UTC (rev 5022)
@@ -1,3 +1,13 @@
+2009-05-26  Werner Koch  <wk at g10code.com>
+
+	* parse-packet.c (mpi_read): Workaround for zero-length MPI bug in
+	libgcrypt<1.5.0.
+
+2009-05-22  Werner Koch  <wk at g10code.com>
+
+	* signal.c (got_fatal_signal): Call new function
+	tty_cleanup_after_signal.
+
 2009-05-20  Werner Koch  <wk at g10code.com>
 
 	* gpg.c (main): Fix --fingerprint/--with-fingerprint command

Modified: trunk/g10/parse-packet.c
===================================================================
--- trunk/g10/parse-packet.c	2009-05-22 15:38:49 UTC (rev 5021)
+++ trunk/g10/parse-packet.c	2009-05-26 09:29:02 UTC (rev 5022)
@@ -139,9 +139,19 @@
       p[i+2] = iobuf_get(inp) & 0xff;
       nread++;
     }
-  if ( gcry_mpi_scan( &a, GCRYMPI_FMT_PGP, buf, nread, &nread ) )
-    a = NULL;
-    
+
+  if (nread >= 2 && !(buf[0] << 8 | buf[1]))
+    {
+      /* Libgcrypt < 1.5.0 accidently rejects zero-length (i.e. zero)
+         MPIs.  We fix this here.  */
+      a = gcry_mpi_new (0);
+    }
+  else
+    {
+      if ( gcry_mpi_scan( &a, GCRYMPI_FMT_PGP, buf, nread, &nread ) )
+        a = NULL;
+    }
+
  leave:
   gcry_free(buf);
   if ( nread > *ret_nread )

Modified: trunk/g10/signal.c
===================================================================
--- trunk/g10/signal.c	2009-05-22 15:38:49 UTC (rev 5021)
+++ trunk/g10/signal.c	2009-05-26 09:29:02 UTC (rev 5022)
@@ -81,6 +81,7 @@
     gcry_control (GCRYCTL_TERM_SECMEM );
 
     tty_cleanup_rl_after_signal ();
+    tty_cleanup_after_signal ();
 
     /* Better don't translate these messages. */
     write(2, "\n", 1 );




More information about the Gnupg-commits mailing list