[svn] GnuPG - r3879 - trunk/mpi
svn author dshaw
cvs at cvs.gnupg.org
Thu Sep 1 15:44:49 CEST 2005
Author: dshaw
Date: 2005-09-01 15:44:49 +0200 (Thu, 01 Sep 2005)
New Revision: 3879
Modified:
trunk/mpi/ChangeLog
trunk/mpi/mpicoder.c
Log:
* mpicoder.c (mpi_read): Fix minor bug in reading a zero-length MPI
(was failing unnecessarily).
Modified: trunk/mpi/ChangeLog
===================================================================
--- trunk/mpi/ChangeLog 2005-08-31 18:40:39 UTC (rev 3878)
+++ trunk/mpi/ChangeLog 2005-09-01 13:44:49 UTC (rev 3879)
@@ -1,3 +1,8 @@
+2005-09-01 David Shaw <dshaw at jabberwocky.com>
+
+ * mpicoder.c (mpi_read): Fix minor bug in reading a zero-length
+ MPI (was failing unnecessarily).
+
2005-05-06 Werner Koch <wk at g10code.com>
* mpi-scan.c (mpi_putbyte, mpi_getbyte): Removed. Not used.
Modified: trunk/mpi/mpicoder.c
===================================================================
--- trunk/mpi/mpicoder.c 2005-08-31 18:40:39 UTC (rev 3878)
+++ trunk/mpi/mpicoder.c 2005-09-01 13:44:49 UTC (rev 3879)
@@ -80,16 +80,20 @@
mpi_limb_t a;
MPI val = MPI_NULL;
+ if (nread == nmax)
+ goto overflow;
if( (c = iobuf_get(inp)) == -1 )
goto leave;
- if (++nread >= nmax)
+ nread++;
+ nbits = c << 8;
+
+ if (nread == nmax)
goto overflow;
- nbits = c << 8;
if( (c = iobuf_get(inp)) == -1 )
goto leave;
- if (++nread >= nmax)
- goto overflow;
+ nread++;
nbits |= c;
+
if( nbits > MAX_EXTERN_MPI_BITS ) {
log_error("mpi too large for this implementation (%u bits)\n", nbits);
goto leave;
@@ -112,7 +116,7 @@
for( ; j > 0; j-- ) {
a = 0;
for(; i < BYTES_PER_MPI_LIMB; i++ ) {
- if (nread >= nmax) {
+ if (nread == nmax) {
#ifdef M_DEBUG
mpi_debug_free (val);
#else
More information about the Gnupg-commits
mailing list