summaryrefslogtreecommitdiffstats
path: root/g10/free-packet.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1999-06-10 14:24:42 +0200
committerWerner Koch <wk@gnupg.org>1999-06-10 14:24:42 +0200
commitb5f36dd0dd6af6ce30f8a51a71b382e90677fd97 (patch)
tree4a0f77aefb7766ab9064a985325990133610204c /g10/free-packet.c
parentSee ChangeLog: Tue Jun 8 13:36:25 CEST 1999 Werner Koch (diff)
downloadgnupg2-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.c18
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);