gpg: Fix segv due to NULL value stored as opaque MPI.
authorWerner Koch <wk@gnupg.org>
Thu, 19 Feb 2015 15:29:58 +0000 (16:29 +0100)
committerWerner Koch <wk@gnupg.org>
Thu, 19 Feb 2015 15:29:58 +0000 (16:29 +0100)
commit76c8122adfed0f0f443cce7bda702ba2b39661b3
treef6ffd6752819ed502205a1bded089fa3fcf3b4a6
parent07a71da479daaac43b8c5b1034a1e66f96bdbc48
gpg: Fix segv due to NULL value stored as opaque MPI.

* g10/build-packet.c (gpg_mpi_write): Check for NULL return from
gcry_mpi_get_opaque.
(gpg_mpi_write_nohdr, do_key): Ditto.
* g10/keyid.c (hash_public_key): Ditto.
--

This fix extends commmit 0835d2f44ef62eab51fce6a927908f544e01cf8f.

  gpg2 --export --no-default-keyring --keyring TESTDATA

With TESTDATA being below after unpacking.

-----BEGIN PGP ARMORED FILE-----

mBMEhdkMmS8BcX8F//8F5voEhQAQmBMEnAAAZwAAo4D/f/8EhQAAAIAEnP8EhQAQ
iBMEnP8AAAAABf8jIID///8EhQYQmBMEnIUAEIgTBKT/AAAAAAUAACCA/f//BIUA
EJgTBJx/AP8ABPPzBJx/AP8ABPPz
=2yE0
-----END PGP ARMORED FILE-----

Reported-by: Jodie Cunningham
Signed-off-by: Werner Koch <wk@gnupg.org>
g10/build-packet.c
g10/keyid.c