From b5f36dd0dd6af6ce30f8a51a71b382e90677fd97 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 10 Jun 1999 12:24:42 +0000 Subject: See ChangeLog: Thu Jun 10 14:18:23 CEST 1999 Werner Koch --- g10/free-packet.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'g10/free-packet.c') diff --git a/g10/free-packet.c b/g10/free-packet.c index 5d74544fc..0a61e222c 100644 --- a/g10/free-packet.c +++ b/g10/free-packet.c @@ -244,8 +244,13 @@ free_encrypted( PKT_encrypted *ed ) ; } else { - while( ed->len ) /* skip the packet */ - ed->len -= iobuf_read( ed->buf, NULL, ed->len ); + while( ed->len ) { /* skip the packet */ + int n = iobuf_read( ed->buf, NULL, ed->len ); + if( n == -1 ) + ed->len = 0; + else + ed->len -= n; + } } } m_free(ed); @@ -261,8 +266,13 @@ free_plaintext( PKT_plaintext *pt ) ; } else { - while( pt->len ) /* skip the packet */ - pt->len -= iobuf_read( pt->buf, NULL, pt->len ); + while( pt->len ) { /* skip the packet */ + int n = iobuf_read( pt->buf, NULL, pt->len ); + if( n == -1 ) + pt->len = 0; + else + pt->len -= n; + } } } m_free(pt); -- cgit v1.2.3