gpg: Fix a NULL-deref in export due to invalid packet lengths.
authorWerner Koch <wk@gnupg.org>
Mon, 9 Feb 2015 09:54:06 +0000 (10:54 +0100)
committerWerner Koch <wk@gnupg.org>
Mon, 9 Feb 2015 09:54:06 +0000 (10:54 +0100)
commit0835d2f44ef62eab51fce6a927908f544e01cf8f
treedb7ac41ac4b1abdbe418d841eb2bec92871c5334
parent39978487863066e59bb657f5fe4e8baab510da7e
gpg: Fix a NULL-deref in export due to invalid packet lengths.

* g10/build-packet.c (write_fake_data): Take care of a NULL stored as
opaque MPI.
--

Reported-by: Hanno Böck <hanno@hboeck.de>
Test data:

     gpg2 --no-default-keyring --keyring FILE --export

With this unpacked data for FILE:

-----BEGIN PGP ARMORED FILE-----
Version: GnuPG v2
Comment: Use "gpg --dearmor" for unpacking

mI0EGRkZGRkZGRkZGRkZGRkBGRkZGRkZGRkZGRkZGQAZGRkZGRkZGRkZGRkZGRkZ
GRkZInzgDbpa/9gQ4wq9////f3Vy81CkyVq3HQaqgZLZOeqPjM7XgGh5hJvAkpec
9wAAAgDHe0FVFbkppJZXP+gFs6z3gobS0qUFeyTtxs+wAgAD
=JDFT
-----END PGP ARMORED FILE-----

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