summaryrefslogtreecommitdiffstats
path: root/g10/armor.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2018-11-08 20:31:12 +0100
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2018-11-08 20:31:12 +0100
commita571bb8df52d6f2727876e086790dd037c9948ad (patch)
tree95576ecfd1f3d9cd27f2e40c2ec9e60b884ec6a6 /g10/armor.c
parentg10/decrypt-data: use iobuf_read for higher performance (diff)
downloadgnupg2-a571bb8df52d6f2727876e086790dd037c9948ad.tar.xz
gnupg2-a571bb8df52d6f2727876e086790dd037c9948ad.zip
g10/armor: fix eof checks in radix64_read
* g10/armor.c (radix64_read): Check EOF with '!afx->buffer_len' instead of 'c == -1', as 'c' is never set to this value. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'g10/armor.c')
-rw-r--r--g10/armor.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/g10/armor.c b/g10/armor.c
index 98b870ab9..1b02a231f 100644
--- a/g10/armor.c
+++ b/g10/armor.c
@@ -793,7 +793,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
byte *buf, size_t size )
{
byte val;
- int c=0, c2; /*init c because gcc is not clever enough for the continue*/
+ int c, c2;
int checkcrc=0;
int rc = 0;
size_t n = 0;
@@ -911,7 +911,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
continue;
break;
}
- if( c == -1 )
+ if( !afx->buffer_len )
log_error(_("premature eof (no CRC)\n"));
else {
u32 mycrc = 0;
@@ -945,7 +945,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
if( !afx->buffer_len )
break; /* eof */
} while( ++idx < 4 );
- if( c == -1 ) {
+ if( !afx->buffer_len ) {
log_info(_("premature eof (in CRC)\n"));
rc = invalid_crc();
}