mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* build-packet.c (calc_plaintext, do_plaintext): Do not create illegal
(packet header indicates a size larger than the actual packet) encrypted data packets when not compressing and using a filename longer than 255 characters.
This commit is contained in:
parent
00bdac950e
commit
5b9ec9dc31
@ -1,3 +1,10 @@
|
|||||||
|
2004-03-26 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* build-packet.c (calc_plaintext, do_plaintext): Do not create
|
||||||
|
illegal (packet header indicates a size larger than the actual
|
||||||
|
packet) encrypted data packets when not compressing and using a
|
||||||
|
filename longer than 255 characters.
|
||||||
|
|
||||||
2004-03-25 David Shaw <dshaw@jabberwocky.com>
|
2004-03-25 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* options.h, g10.c (main), compress-bz2.c (init_uncompress):
|
* options.h, g10.c (main), compress-bz2.c (init_uncompress):
|
||||||
|
@ -528,7 +528,14 @@ do_pubkey_enc( IOBUF out, int ctb, PKT_pubkey_enc *enc )
|
|||||||
static u32
|
static u32
|
||||||
calc_plaintext( PKT_plaintext *pt )
|
calc_plaintext( PKT_plaintext *pt )
|
||||||
{
|
{
|
||||||
return pt->len? (1 + 1 + pt->namelen + 4 + pt->len) : 0;
|
/* Truncate namelen to the maximum 255 characters. Note this means
|
||||||
|
that a function that calls build_packet with an illegal literal
|
||||||
|
packet will get it back legalized. */
|
||||||
|
|
||||||
|
if(pt->namelen>255)
|
||||||
|
pt->namelen=255;
|
||||||
|
|
||||||
|
return pt->len? (1 + 1 + pt->namelen + 4 + pt->len) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -539,12 +546,6 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
|
|||||||
byte buf[1000]; /* this buffer has the plaintext! */
|
byte buf[1000]; /* this buffer has the plaintext! */
|
||||||
int nbytes;
|
int nbytes;
|
||||||
|
|
||||||
/* Truncate namelen to the maximum 255 characters. This does mean
|
|
||||||
that a function that calls build_packet with an illegal literal
|
|
||||||
packet will get it back legalized. */
|
|
||||||
if(pt->namelen>255)
|
|
||||||
pt->namelen=255;
|
|
||||||
|
|
||||||
write_header(out, ctb, calc_plaintext( pt ) );
|
write_header(out, ctb, calc_plaintext( pt ) );
|
||||||
iobuf_put(out, pt->mode );
|
iobuf_put(out, pt->mode );
|
||||||
iobuf_put(out, pt->namelen );
|
iobuf_put(out, pt->namelen );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user