mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* seckey-cert.c (do_check): Handle case when checksum was okay but
passphrase still wrong. Roman Pavlik found such a case. * mpicoder.c (mpi_read_from_buffer): Don't abort in case of an invalid MPI but print a message and return NULL. Use log_info and not log_error.
This commit is contained in:
parent
be4bb5a88b
commit
9e3526f236
6 changed files with 49 additions and 8 deletions
|
@ -125,7 +125,7 @@ mpi_read(IOBUF inp, unsigned *ret_nread, int secure)
|
|||
|
||||
|
||||
MPI
|
||||
mpi_read_from_buffer(byte *buffer, unsigned *ret_nread, int secure)
|
||||
mpi_read_from_buffer(byte *buffer, unsigned int *ret_nread, int secure)
|
||||
{
|
||||
int i, j;
|
||||
unsigned nbits, nbytes, nlimbs, nread=0;
|
||||
|
@ -136,7 +136,7 @@ mpi_read_from_buffer(byte *buffer, unsigned *ret_nread, int secure)
|
|||
goto leave;
|
||||
nbits = buffer[0] << 8 | buffer[1];
|
||||
if( nbits > MAX_EXTERN_MPI_BITS ) {
|
||||
log_error("mpi too large (%u bits)\n", nbits);
|
||||
log_info ("mpi too large (%u bits)\n", nbits);
|
||||
goto leave;
|
||||
}
|
||||
buffer += 2;
|
||||
|
@ -154,10 +154,19 @@ mpi_read_from_buffer(byte *buffer, unsigned *ret_nread, int secure)
|
|||
for( ; j > 0; j-- ) {
|
||||
a = 0;
|
||||
for(; i < BYTES_PER_MPI_LIMB; i++ ) {
|
||||
if( ++nread > *ret_nread )
|
||||
log_bug("mpi larger than buffer\n");
|
||||
a <<= 8;
|
||||
a |= *buffer++;
|
||||
if( ++nread > *ret_nread ) {
|
||||
/* This (as well as the above error condition) may
|
||||
happen if we use this function to parse a decrypted
|
||||
MPI which didn't turn out to be a real MPI - possible
|
||||
because the supplied key was wrong but the OpenPGP
|
||||
checksum didn't caught it. */
|
||||
log_info ("mpi larger than buffer\n");
|
||||
mpi_free (val);
|
||||
val = MPI_NULL;
|
||||
goto leave;
|
||||
}
|
||||
a <<= 8;
|
||||
a |= *buffer++;
|
||||
}
|
||||
i = 0;
|
||||
val->d[j-1] = a;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue