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,6 +252,8 @@ mpi_read_detect_0_removal (iobuf_t inp, unsigned int *ret_nread, int secure,
|
|||||||
a = NULL;
|
a = NULL;
|
||||||
|
|
||||||
/* Possibly, it has leading zeros. */
|
/* Possibly, it has leading zeros. */
|
||||||
|
if (a)
|
||||||
|
{
|
||||||
nbits1 = gcry_mpi_get_nbits (a);
|
nbits1 = gcry_mpi_get_nbits (a);
|
||||||
if (nbits > nbits1)
|
if (nbits > nbits1)
|
||||||
{
|
{
|
||||||
@ -260,6 +262,7 @@ mpi_read_detect_0_removal (iobuf_t inp, unsigned int *ret_nread, int secure,
|
|||||||
*r_csum_tweak += (nbits1 >> 8);
|
*r_csum_tweak += (nbits1 >> 8);
|
||||||
*r_csum_tweak += (nbits1 & 0xff);
|
*r_csum_tweak += (nbits1 & 0xff);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*ret_nread = nread;
|
*ret_nread = nread;
|
||||||
gcry_free(buf);
|
gcry_free(buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user