mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-23 15:07:03 +01:00
* mpicoder.c (mpi_read): Fix minor bug in reading a zero-length MPI
(was failing unnecessarily).
This commit is contained in:
parent
187eaf0665
commit
516ec53e02
@ -1,3 +1,8 @@
|
|||||||
|
2005-09-01 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* mpicoder.c (mpi_read): Fix minor bug in reading a zero-length
|
||||||
|
MPI (was failing unnecessarily).
|
||||||
|
|
||||||
2005-05-06 Werner Koch <wk@g10code.com>
|
2005-05-06 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* mpi-scan.c (mpi_putbyte, mpi_getbyte): Removed. Not used.
|
* mpi-scan.c (mpi_putbyte, mpi_getbyte): Removed. Not used.
|
||||||
|
@ -80,16 +80,20 @@ mpi_read(IOBUF inp, unsigned *ret_nread, int secure)
|
|||||||
mpi_limb_t a;
|
mpi_limb_t a;
|
||||||
MPI val = MPI_NULL;
|
MPI val = MPI_NULL;
|
||||||
|
|
||||||
|
if (nread == nmax)
|
||||||
|
goto overflow;
|
||||||
if( (c = iobuf_get(inp)) == -1 )
|
if( (c = iobuf_get(inp)) == -1 )
|
||||||
goto leave;
|
goto leave;
|
||||||
if (++nread >= nmax)
|
nread++;
|
||||||
goto overflow;
|
|
||||||
nbits = c << 8;
|
nbits = c << 8;
|
||||||
|
|
||||||
|
if (nread == nmax)
|
||||||
|
goto overflow;
|
||||||
if( (c = iobuf_get(inp)) == -1 )
|
if( (c = iobuf_get(inp)) == -1 )
|
||||||
goto leave;
|
goto leave;
|
||||||
if (++nread >= nmax)
|
nread++;
|
||||||
goto overflow;
|
|
||||||
nbits |= c;
|
nbits |= c;
|
||||||
|
|
||||||
if( nbits > MAX_EXTERN_MPI_BITS ) {
|
if( nbits > MAX_EXTERN_MPI_BITS ) {
|
||||||
log_error("mpi too large for this implementation (%u bits)\n", nbits);
|
log_error("mpi too large for this implementation (%u bits)\n", nbits);
|
||||||
goto leave;
|
goto leave;
|
||||||
@ -112,7 +116,7 @@ mpi_read(IOBUF inp, unsigned *ret_nread, int secure)
|
|||||||
for( ; j > 0; j-- ) {
|
for( ; j > 0; j-- ) {
|
||||||
a = 0;
|
a = 0;
|
||||||
for(; i < BYTES_PER_MPI_LIMB; i++ ) {
|
for(; i < BYTES_PER_MPI_LIMB; i++ ) {
|
||||||
if (nread >= nmax) {
|
if (nread == nmax) {
|
||||||
#ifdef M_DEBUG
|
#ifdef M_DEBUG
|
||||||
mpi_debug_free (val);
|
mpi_debug_free (val);
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user