1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

gpg: Do not allow compressed key packets on import.

* g10/import.c (read_block): Bail out on compressed packets.
* g10/options.h (COMPAT_COMPR_KEYS): New.
* g10/gpg.c (compatibility_flags): Add "compr-keys".
* common/util.h: Remove replacement code not any longer needed.
(GPG_ERR_UNEXPECTED_PACKET): Add a new replacement code.
--

Compressed key packets do not make much sense but historically they
were supported.  Thus we also add a compatibility flag.

GnuPG-bug-id: 7014
This commit is contained in:
Werner Koch 2025-05-16 12:37:45 +02:00
parent 645cf7d8fc
commit 8e529f9221
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 11 additions and 6 deletions

View file

@ -1058,7 +1058,12 @@ read_block( IOBUF a, unsigned int options,
switch (pkt->pkttype)
{
case PKT_COMPRESSED:
if (check_compress_algo (pkt->pkt.compressed->algorithm))
if (!(opt.compat_flags & COMPAT_COMPR_KEYS))
{
rc = GPG_ERR_UNEXPECTED_PACKET;
goto ready;
}
else if (check_compress_algo (pkt->pkt.compressed->algorithm))
{
rc = GPG_ERR_COMPR_ALGO;
goto ready;