1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Fix bug#931.

Silent a compiler warning.
This commit is contained in:
Werner Koch 2009-05-05 09:30:34 +00:00
parent 7c57091f10
commit a4fd67937c
3 changed files with 46 additions and 28 deletions

View file

@ -346,12 +346,19 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
rc = G10ERR_INVALID_PACKET;
goto leave;
}
if (pkttype == PKT_COMPRESSED) {
iobuf_set_partial_block_mode(inp, c & 0xff);
pktlen = 0;/* to indicate partial length */
partial=1;
}
else {
/* The follwing code has been here for ages (2002-08-30) but it is
clearly wrong: For example passing a 0 as second argument to
iobuf_set_partial_block_mode stops the partial block mode which we
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
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;
if( c < 192 )
pktlen = c;
@ -384,20 +391,22 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
}
else
{
/* Partial body length. Note that we handled
PKT_COMPRESSED earlier. */
if(pkttype==PKT_PLAINTEXT || pkttype==PKT_ENCRYPTED
|| pkttype==PKT_ENCRYPTED_MDC)
{
iobuf_set_partial_block_mode(inp, c & 0xff);
pktlen = 0;/* to indicate partial length */
partial=1;
}
else
{
log_error("%s: partial length for invalid"
" packet type %d\n",iobuf_where(inp),pkttype);
rc=G10ERR_INVALID_PACKET;
/* Partial body length. */
switch (pkttype)
{
case PKT_PLAINTEXT:
case PKT_ENCRYPTED:
case PKT_ENCRYPTED_MDC:
case PKT_COMPRESSED:
iobuf_set_partial_block_mode (inp, (c & 0xff));
pktlen = 0; /* Indicate partial length. */
partial= 1;
break;
default:
log_error ("%s: partial length for invalid"
" packet type %d\n", iobuf_where(inp),pkttype);
rc = G10ERR_INVALID_PACKET;
goto leave;
}
}