aboutsummaryrefslogtreecommitdiffstats
path: root/g10/build-packet.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2004-04-16 16:31:19 +0000
committerDavid Shaw <[email protected]>2004-04-16 16:31:19 +0000
commitd49a7e1a7ab91e4b741076c8c9d8436c9df574ed (patch)
treee94b0738078740ab84e8660bd747863794b6f8f2 /g10/build-packet.c
parent* keygen.c (gen_elg, gen_dsa, gen_rsa, do_create, do_generate_keypair, (diff)
downloadgnupg-d49a7e1a7ab91e4b741076c8c9d8436c9df574ed.tar.gz
gnupg-d49a7e1a7ab91e4b741076c8c9d8436c9df574ed.zip
* plaintext.c (handle_plaintext): Accept 'u' as a plaintext mode that
requires end of line conversion. This is being considered for a UTF8 text packet. If this doesn't take place, no major harm done. If it does take place, we'll get a jump on starting the changeover. * g10.c (main): --no-use-embedded-filename. * 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. * keyedit.c (no_primary_warning): Cleanup. (menu_expire): Don't give primary warning for subkey expiration changes. These cannot reorder primaries.
Diffstat (limited to '')
-rw-r--r--g10/build-packet.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index 57d75758a..a7e03ae0b 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -460,7 +460,14 @@ do_pubkey_enc( IOBUF out, int ctb, PKT_pubkey_enc *enc )
static u32
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
@@ -471,12 +478,6 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
byte buf[1000]; /* this buffer has the plaintext! */
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 ) );
iobuf_put(out, pt->mode );
iobuf_put(out, pt->namelen );