aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2006-11-10 11:32:00 +0000
committerWerner Koch <[email protected]>2006-11-10 11:32:00 +0000
commitcd3e8c9b89b37c833c6d6a0ec54448cfc561cec1 (patch)
treec38e7a038ddf017a6854051d3638f319874591e9 /g10/parse-packet.c
parentgpg-agent.c (main): In detached mode connect standard descriptors to /dev/null. (diff)
downloadgnupg-cd3e8c9b89b37c833c6d6a0ec54448cfc561cec1.tar.gz
gnupg-cd3e8c9b89b37c833c6d6a0ec54448cfc561cec1.zip
Fixed that nasty 64 bit but.
Diffstat (limited to 'g10/parse-packet.c')
-rw-r--r--g10/parse-packet.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index 5b8f2de64..d60d5d7dd 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -112,41 +112,41 @@ mpi_read (iobuf_t inp, unsigned int *ret_nread, int secure)
/*FIXME: Needs to be synced with gnupg14/mpi/mpicoder.c*/
int c, c1, c2, i;
- unsigned int nbits, nbytes, nread=0;
+ unsigned int nbits, nbytes;
+ size_t nread;
gcry_mpi_t a = NULL;
byte *buf = NULL;
byte *p;
- if( (c = c1 = iobuf_get(inp)) == -1 )
+ if ( (c = c1 = iobuf_get (inp)) == -1 )
goto leave;
nbits = c << 8;
- if( (c = c2 = iobuf_get(inp)) == -1 )
+ if ( (c = c2 = iobuf_get (inp)) == -1 )
goto leave;
nbits |= c;
- if( nbits > MAX_EXTERN_MPI_BITS )
+ if ( nbits > MAX_EXTERN_MPI_BITS )
{
log_error("mpi too large (%u bits)\n", nbits);
goto leave;
}
nread = 2;
nbytes = (nbits+7) / 8;
- buf = secure? gcry_xmalloc_secure( nbytes+2 ) : gcry_xmalloc( nbytes+2 );
+ buf = secure ? gcry_xmalloc_secure (nbytes + 2) : gcry_xmalloc (nbytes + 2);
p = buf;
p[0] = c1;
p[1] = c2;
- for( i=0 ; i < nbytes; i++ )
+ for ( i=0 ; i < nbytes; i++ )
{
p[i+2] = iobuf_get(inp) & 0xff;
nread++;
}
- nread += nbytes;
- if( gcry_mpi_scan( &a, GCRYMPI_FMT_PGP, buf, nread, &nread ) )
+ if ( gcry_mpi_scan( &a, GCRYMPI_FMT_PGP, buf, nread, &nread ) )
a = NULL;
leave:
gcry_free(buf);
- if( nread > *ret_nread )
- log_bug("mpi larger than packet");
+ if ( nread > *ret_nread )
+ log_bug ("mpi larger than packet");
else
*ret_nread = nread;
return a;