gpg: Fix segv due to NULL value stored as opaque MPI (BRANCH 2.0)
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sat, 21 Feb 2015 23:23:44 +0000 (18:23 -0500)
committerWerner Koch <wk@gnupg.org>
Tue, 2 Jun 2015 15:22:27 +0000 (17:22 +0200)
commitb2d9d105f717dc6c02ac81b5d987851279c4cd97
tree648fac5a138e92bedbc60ac58c4c241e20086255
parent9dcf345a845c87e3beea1f757cd93ce229423972
gpg: Fix segv due to NULL value stored as opaque MPI (BRANCH 2.0)

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

This is a backport of 76c8122adfed0f0f443cce7bda702ba2b39661b3 from
master to the STABLE-BRANCH-2-0

On the STABLE-BRANCH-2-0, we may also want to patch g10/seckey-cert.c,
but that has not been done in this patch.

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: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
g10/build-packet.c
g10/keyid.c