mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-08 17:43:04 +01:00
gpg: Import only packets which are allowed in a keyblock.
* g10/import.c (valid_keyblock_packet): New. (read_block): Store only valid packets. -- A corrupted key, which for example included a mangled public key encrypted packet, used to corrupt the keyring. This change skips all packets which are not allowed in a keyblock. GnuPG-bug-id: 1455 (cherry-picked from commit 3a4b96e665fa639772854058737ee3d54ba0694e)
This commit is contained in:
parent
20c95ef258
commit
498882296f
23
g10/import.c
23
g10/import.c
@ -347,6 +347,27 @@ import_print_stats (void *hd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return true if PKTTYPE is valid in a keyblock. */
|
||||||
|
static int
|
||||||
|
valid_keyblock_packet (int pkttype)
|
||||||
|
{
|
||||||
|
switch (pkttype)
|
||||||
|
{
|
||||||
|
case PKT_PUBLIC_KEY:
|
||||||
|
case PKT_PUBLIC_SUBKEY:
|
||||||
|
case PKT_SECRET_KEY:
|
||||||
|
case PKT_SECRET_SUBKEY:
|
||||||
|
case PKT_SIGNATURE:
|
||||||
|
case PKT_USER_ID:
|
||||||
|
case PKT_ATTRIBUTE:
|
||||||
|
case PKT_RING_TRUST:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* Read the next keyblock from stream A.
|
* Read the next keyblock from stream A.
|
||||||
* PENDING_PKT should be initialzed to NULL
|
* PENDING_PKT should be initialzed to NULL
|
||||||
@ -424,7 +445,7 @@ read_block( IOBUF a, PACKET **pending_pkt, KBNODE *ret_root )
|
|||||||
}
|
}
|
||||||
in_cert = 1;
|
in_cert = 1;
|
||||||
default:
|
default:
|
||||||
if( in_cert ) {
|
if (in_cert && valid_keyblock_packet (pkt->pkttype)) {
|
||||||
if( !root )
|
if( !root )
|
||||||
root = new_kbnode( pkt );
|
root = new_kbnode( pkt );
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user