From 6587b15a5975755cd6b717e1e1dfb6bd769dc6c2 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sun, 3 Mar 2002 14:08:39 +0000 Subject: Solved conflict --- g10/ChangeLog | 4 ++++ g10/parse-packet.c | 37 ++++++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index ccdc0f98e..12b923f2d 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -96,6 +96,10 @@ * hkp.c (parse_hkp_index): Bug fix - don't report non-revoked keys as revoked in HKP key searches. +2002-02-19 Werner Koch + + * parse-packet.c (parse_trust): Made parsing more robust. + 2002-02-19 David Shaw * hkp.c (parse_hkp_index): Catch corruption in HKP index lines diff --git a/g10/parse-packet.c b/g10/parse-packet.c index e27e22c85..ef561976d 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1881,23 +1881,34 @@ parse_comment( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) static void parse_trust( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt ) { - int c; - - c = iobuf_get_noeof(inp); - pkt->pkt.ring_trust = m_alloc( sizeof *pkt->pkt.ring_trust ); - pkt->pkt.ring_trust->trustval = c; - pkt->pkt.ring_trust->sigcache = 0; - if (!c && pktlen==2) { - c = iobuf_get_noeof (inp); - /* we require that bit 7 of the sigcache is 0 (easier eof handling)*/ - if ( !(c & 0x80) ) + int c; + + if (pktlen) + { + c = iobuf_get_noeof(inp); + pktlen--; + pkt->pkt.ring_trust = m_alloc( sizeof *pkt->pkt.ring_trust ); + pkt->pkt.ring_trust->trustval = c; + pkt->pkt.ring_trust->sigcache = 0; + if (!c && pktlen==1) + { + c = iobuf_get_noeof (inp); + pktlen--; + /* we require that bit 7 of the sigcache is 0 (easier eof handling)*/ + if ( !(c & 0x80) ) pkt->pkt.ring_trust->sigcache = c; - } - if( list_mode ) + } + if( list_mode ) printf(":trust packet: flag=%02x sigcache=%02x\n", pkt->pkt.ring_trust->trustval, pkt->pkt.ring_trust->sigcache); - + } + else + { + if( list_mode ) + printf(":trust packet: empty\n"); + } + skip_rest (inp, pktlen); } -- cgit v1.2.3