1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-26 01:52:45 +02:00

* mpicoder.c (mpi_read): If we must fail due to a oversize (generally

corrupt) MPI, make sure the number of bytes we read is valid so we can
skip the rest of the bad packet (in hopes the whole stream isn't invalid).
This commit is contained in:
David Shaw 2004-09-30 04:07:23 +00:00
parent 742682bf95
commit ec0cc1f135
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2004-09-29 David Shaw <dshaw@jabberwocky.com>
* mpicoder.c (mpi_read): If we must fail due to a oversize
(generally corrupt) MPI, make sure the number of bytes we read is
valid so we can skip the rest of the bad packet (in hopes the
whole stream isn't invalid).
2004-05-20 David Shaw <dshaw@jabberwocky.com>
* longlong.h: Typo.

View File

@ -80,15 +80,16 @@ mpi_read(IOBUF inp, unsigned *ret_nread, int secure)
if( (c = iobuf_get(inp)) == -1 )
goto leave;
nread++;
nbits = c << 8;
if( (c = iobuf_get(inp)) == -1 )
goto leave;
nread++;
nbits |= c;
if( nbits > MAX_EXTERN_MPI_BITS ) {
log_error("mpi too large (%u bits)\n", nbits);
goto leave;
}
nread = 2;
nbytes = (nbits+7) / 8;
nlimbs = (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB;