diff options
author | Werner Koch <wk@gnupg.org> | 2008-09-25 14:55:50 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-09-25 14:55:50 +0200 |
commit | b77e7c9f2e407b0d489fde6171d96d506a06ce9c (patch) | |
tree | 35ebdae55e1f5702ddd3431928a05b57aa9bbaba /g10 | |
parent | Finished support for v2 cards with the exception of secure messaging. (diff) | |
download | gnupg2-b77e7c9f2e407b0d489fde6171d96d506a06ce9c.tar.xz gnupg2-b77e7c9f2e407b0d489fde6171d96d506a06ce9c.zip |
Fix bug #931
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 3 | ||||
-rw-r--r-- | g10/parse-packet.c | 42 |
2 files changed, 29 insertions, 16 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 28a6cd9ce..326e9f282 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,8 @@ 2008-09-25 Werner Koch <wk@g10code.com> + * parse-packet.c (parse): Remove special treatment for compressed + new style packets. Fixes bug#931. + * card-util.c (change_pin): Support setting of the reset code. 2008-09-24 Werner Koch <wk@g10code.com> diff --git a/g10/parse-packet.c b/g10/parse-packet.c index dbaa27886..a15038d92 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -395,12 +395,20 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos, rc = gpg_error (GPG_ERR_INV_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; @@ -433,19 +441,21 @@ 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) - { + /* 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;/* to indicate partial length */ + pktlen = 0;/* To indicate partial length. */ partial=1; - } - else - { + break; + + default: log_error("%s: partial length for invalid" - " packet type %d\n",iobuf_where(inp),pkttype); + " packet type %d\n", iobuf_where(inp),pkttype); rc = gpg_error (GPG_ERR_INV_PACKET); goto leave; } |