mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
gpg: Minor robustness fix.
* g10/parse-packet.c (mpi_read_detect_0_removal): Protect agains failed gcry_mpi_scan. -- Fixes-commit: 3fcef7371480cce392d690897d42955f1b19c12a
This commit is contained in:
parent
06e82e997a
commit
36a5509e11
@ -252,13 +252,16 @@ mpi_read_detect_0_removal (iobuf_t inp, unsigned int *ret_nread, int secure,
|
||||
a = NULL;
|
||||
|
||||
/* Possibly, it has leading zeros. */
|
||||
nbits1 = gcry_mpi_get_nbits (a);
|
||||
if (nbits > nbits1)
|
||||
if (a)
|
||||
{
|
||||
*r_csum_tweak -= (nbits >> 8);
|
||||
*r_csum_tweak -= (nbits & 0xff);
|
||||
*r_csum_tweak += (nbits1 >> 8);
|
||||
*r_csum_tweak += (nbits1 & 0xff);
|
||||
nbits1 = gcry_mpi_get_nbits (a);
|
||||
if (nbits > nbits1)
|
||||
{
|
||||
*r_csum_tweak -= (nbits >> 8);
|
||||
*r_csum_tweak -= (nbits & 0xff);
|
||||
*r_csum_tweak += (nbits1 >> 8);
|
||||
*r_csum_tweak += (nbits1 & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
*ret_nread = nread;
|
||||
|
Loading…
x
Reference in New Issue
Block a user