File gnupg-CVE-2019-13050_0_of_5.patch of Package gpg2.30813
From 894b72d796c826b1c7e1df788e16874cd051e672 Mon Sep 17 00:00:00 2001
From: Werner Koch <wk@gnupg.org>
Date: Mon, 1 Jul 2019 14:01:08 +0200
Subject: [PATCH] gpg: Make read_block in import.c more flexible.
* g10/import.c: Change arg 'with_meta' to 'options'. Change callers.
--
This chnage allows to pass more options to read_block.
Signed-off-by: Werner Koch <wk@gnupg.org>
---
g10/import.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
Index: gnupg-2.0.24/g10/import.c
===================================================================
--- gnupg-2.0.24.orig/g10/import.c
+++ gnupg-2.0.24/g10/import.c
@@ -61,7 +61,8 @@ struct stats_s {
static int import( IOBUF inp, const char* fname,struct stats_s *stats,
unsigned char **fpr,size_t *fpr_len,unsigned int options,
import_filter_t filter, void *filter_arg );
-static int read_block( IOBUF a, PACKET **pending_pkt, KBNODE *ret_root );
+static int read_block( IOBUF a, unsigned int options, PACKET **pending_pkt,
+ KBNODE *ret_root);
static void revocation_present(KBNODE keyblock);
static int import_one(const char *fname, KBNODE keyblock,struct stats_s *stats,
unsigned char **fpr,size_t *fpr_len,
@@ -263,7 +264,7 @@ import (IOBUF inp, const char* fname,str
release_armor_context (afx);
}
- while( !(rc = read_block( inp, &pending_pkt, &keyblock) )) {
+ while( !(rc = read_block(inp, options, &pending_pkt, &keyblock))) {
if( keyblock->pkt->pkttype == PKT_PUBLIC_KEY )
rc = import_one (fname, keyblock, stats, fpr, fpr_len, options, 0,
filter, filter_arg);
@@ -379,14 +380,16 @@ valid_keyblock_packet (int pkttype)
}
-/****************
- * Read the next keyblock from stream A.
- * PENDING_PKT should be initialzed to NULL
- * and not chnaged form the caller.
- * Retunr: 0 = okay, -1 no more blocks or another errorcode.
+/* Read the next keyblock from stream A. Meta data (ring trust
+ * packets) are only considered if OPTIONS has the IMPORT_RESTORE flag
+ * set. PENDING_PKT should be initialized to NULL and not changed by
+ * the caller.
+ *
+ * Returns 0 for okay, -1 no more blocks, or any other errorcode.
*/
static int
-read_block( IOBUF a, PACKET **pending_pkt, KBNODE *ret_root )
+read_block( IOBUF a, unsigned int options,
+ PACKET **pending_pkt, KBNODE *ret_root )
{
int rc;
PACKET *pkt;