diff options
author | Werner Koch <wk@gnupg.org> | 1999-06-10 14:24:42 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1999-06-10 14:24:42 +0200 |
commit | b5f36dd0dd6af6ce30f8a51a71b382e90677fd97 (patch) | |
tree | 4a0f77aefb7766ab9064a985325990133610204c /g10/free-packet.c | |
parent | See ChangeLog: Tue Jun 8 13:36:25 CEST 1999 Werner Koch (diff) | |
download | gnupg2-b5f36dd0dd6af6ce30f8a51a71b382e90677fd97.tar.xz gnupg2-b5f36dd0dd6af6ce30f8a51a71b382e90677fd97.zip |
See ChangeLog: Thu Jun 10 14:18:23 CEST 1999 Werner Koch
Diffstat (limited to 'g10/free-packet.c')
-rw-r--r-- | g10/free-packet.c | 18 |
1 files changed, 14 insertions, 4 deletions
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); |