mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
Fix bug#931.
Silent a compiler warning.
This commit is contained in:
parent
7c57091f10
commit
a4fd67937c
@ -1,3 +1,12 @@
|
|||||||
|
2009-05-05 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* tdbio.c (lookup_hashtable): Add const to function args.
|
||||||
|
(cmp_trec_fpr): Ditto.
|
||||||
|
(tdbio_search_trust_byfpr): Remove cast.
|
||||||
|
|
||||||
|
* parse-packet.c (parse): Remove special treatment for compressed
|
||||||
|
new style packets. Fixes bug#931.
|
||||||
|
|
||||||
2009-04-03 Werner Koch <wk@g10code.com>
|
2009-04-03 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpgv.c (main): Pass readonly flag to keydb_add_resource.
|
* gpgv.c (main): Pass readonly flag to keydb_add_resource.
|
||||||
|
@ -346,12 +346,19 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
|
|||||||
rc = G10ERR_INVALID_PACKET;
|
rc = G10ERR_INVALID_PACKET;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if (pkttype == PKT_COMPRESSED) {
|
/* The follwing code has been here for ages (2002-08-30) but it is
|
||||||
iobuf_set_partial_block_mode(inp, c & 0xff);
|
clearly wrong: For example passing a 0 as second argument to
|
||||||
pktlen = 0;/* to indicate partial length */
|
iobuf_set_partial_block_mode stops the partial block mode which we
|
||||||
partial=1;
|
definitely do not want. Also all values < 224 or 255 are not
|
||||||
}
|
valid. Let's disable it and put PKT_COMPRESSED into the list of
|
||||||
else {
|
allowed packets with partial header until someone complains. */
|
||||||
|
/* if (pkttype == PKT_COMPRESSED) { */
|
||||||
|
/* iobuf_set_partial_block_mode(inp, c & 0xff); */
|
||||||
|
/* pktlen = 0;/\* to indicate partial length *\/ */
|
||||||
|
/* partial=1; */
|
||||||
|
/* } */
|
||||||
|
/* else { */
|
||||||
|
{
|
||||||
hdr[hdrlen++] = c;
|
hdr[hdrlen++] = c;
|
||||||
if( c < 192 )
|
if( c < 192 )
|
||||||
pktlen = c;
|
pktlen = c;
|
||||||
@ -384,20 +391,22 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Partial body length. Note that we handled
|
/* Partial body length. */
|
||||||
PKT_COMPRESSED earlier. */
|
switch (pkttype)
|
||||||
if(pkttype==PKT_PLAINTEXT || pkttype==PKT_ENCRYPTED
|
{
|
||||||
|| pkttype==PKT_ENCRYPTED_MDC)
|
case PKT_PLAINTEXT:
|
||||||
{
|
case PKT_ENCRYPTED:
|
||||||
iobuf_set_partial_block_mode(inp, c & 0xff);
|
case PKT_ENCRYPTED_MDC:
|
||||||
pktlen = 0;/* to indicate partial length */
|
case PKT_COMPRESSED:
|
||||||
partial=1;
|
iobuf_set_partial_block_mode (inp, (c & 0xff));
|
||||||
}
|
pktlen = 0; /* Indicate partial length. */
|
||||||
else
|
partial= 1;
|
||||||
{
|
break;
|
||||||
log_error("%s: partial length for invalid"
|
|
||||||
" packet type %d\n",iobuf_where(inp),pkttype);
|
default:
|
||||||
rc=G10ERR_INVALID_PACKET;
|
log_error ("%s: partial length for invalid"
|
||||||
|
" packet type %d\n", iobuf_where(inp),pkttype);
|
||||||
|
rc = G10ERR_INVALID_PACKET;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
g10/tdbio.c
16
g10/tdbio.c
@ -1007,8 +1007,8 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
lookup_hashtable( ulong table, const byte *key, size_t keylen,
|
lookup_hashtable( ulong table, const byte *key, size_t keylen,
|
||||||
int (*cmpfnc)(void*, const TRUSTREC *), void *cmpdata,
|
int (*cmpfnc)(const void*, const TRUSTREC *),
|
||||||
TRUSTREC *rec )
|
const void *cmpdata, TRUSTREC *rec )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
ulong hashrec, item;
|
ulong hashrec, item;
|
||||||
@ -1464,10 +1464,10 @@ tdbio_new_recnum()
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmp_trec_fpr ( void *fpr, const TRUSTREC *rec )
|
cmp_trec_fpr (const void *fpr, const TRUSTREC *rec )
|
||||||
{
|
{
|
||||||
return rec->rectype == RECTYPE_TRUST
|
return (rec->rectype == RECTYPE_TRUST
|
||||||
&& !memcmp( rec->r.trust.fingerprint, fpr, 20);
|
&& !memcmp( rec->r.trust.fingerprint, fpr, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1476,9 +1476,9 @@ tdbio_search_trust_byfpr( const byte *fingerprint, TRUSTREC *rec )
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* locate the trust record using the hash table */
|
/* Locate the trust record using the hash table. */
|
||||||
rc = lookup_hashtable( get_trusthashrec(), fingerprint, 20,
|
rc = lookup_hashtable (get_trusthashrec(), fingerprint, 20,
|
||||||
cmp_trec_fpr, (void*)fingerprint, rec );
|
cmp_trec_fpr, fingerprint, rec);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user