From 156788a43c20e38cd52f4f725395aff2c72142ff Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 21 May 2019 16:25:56 +0200 Subject: gpg: Do not allow creation of user ids larger than our parser allows. * g10/parse-packet.c: Move max packet lengths constants to ... * g10/packet.h: ... here. * g10/build-packet.c (do_user_id): Return an error if too data is too large. * g10/keygen.c (write_uid): Return an error for too large data. -- This can lead to keyring corruption becuase we expect that our parser is abale to parse packts created by us. Test case is gpg --batch --passphrase 'abc' -v \ --quick-gen-key $(yes 'a'| head -4000|tr -d '\n') GnuPG-bug-id: 4532 Signed-off-by: Werner Koch --- g10/parse-packet.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'g10/parse-packet.c') diff --git a/g10/parse-packet.c b/g10/parse-packet.c index f67edc547..ab82d475a 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -38,12 +38,6 @@ #include "../common/mbox-util.h" -/* Maximum length of packets to avoid excessive memory allocation. */ -#define MAX_KEY_PACKET_LENGTH (256 * 1024) -#define MAX_UID_PACKET_LENGTH ( 2 * 1024) -#define MAX_COMMENT_PACKET_LENGTH ( 64 * 1024) -#define MAX_ATTR_PACKET_LENGTH ( 16 * 1024*1024) - static int mpi_print_mode; static int list_mode; static estream_t listfp; -- cgit v1.2.3