diff options
author | David Shaw <[email protected]> | 2005-05-11 19:31:53 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2005-05-11 19:31:53 +0000 |
commit | e81d88b26541d669e1b9c59ebd0815f67469a61b (patch) | |
tree | 56ed76a701cdc7c58b162bcafcb615e8250a2ba7 /g10/parse-packet.c | |
parent | (do_close_reader): Don't do a reset before close. (diff) | |
download | gnupg-e81d88b26541d669e1b9c59ebd0815f67469a61b.tar.gz gnupg-e81d88b26541d669e1b9c59ebd0815f67469a61b.zip |
* keygen.c (write_selfsigs): Rename from write_selfsig. Write the same
selfsig into both the pk and sk, so that someone importing their sk (which
will get an autoconvert to the pk) won't end up with two selfsigs.
(do_generate_keypair): Call it from here.
* parse-packet.c (can_handle_critical_notation): New. Check for
particular notation tags that we will accept when critical. Currently,
that's only [email protected], since we know how to handle
it (pass it through to a mail program). (can_handle_critical): Call it
from here. (parse_one_sig_subpkt): Sanity check that notations are
well-formed in that the internal lengths add up to the size of the
subpacket.
Diffstat (limited to '')
-rw-r--r-- | g10/parse-packet.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c index fde96c476..71d3d2fba 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1,6 +1,6 @@ /* parse-packet.c - read packets - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, - * 2004, 2005 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, + * 2005 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -1016,7 +1016,10 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type ) break; return 0; case SIGSUBPKT_NOTATION: - if( n < 8 ) /* minimum length needed */ + /* minimum length needed, and the subpacket must be well-formed + where the name length and value length all fit inside the + packet. */ + if(n<8 || 8+((buffer[4]<<8)|buffer[5])+((buffer[6]<<8)|buffer[7]) != n) break; return 0; case SIGSUBPKT_PRIMARY_UID: @@ -1032,6 +1035,15 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type ) return -2; } +/* Not many critical notations we understand yet... */ +static int +can_handle_critical_notation(const byte *name,size_t len) +{ + if(len==32 && memcmp(name,"[email protected]",32)==0) + return 1; + + return 0; +} static int can_handle_critical( const byte *buffer, size_t n, int type ) @@ -1039,10 +1051,10 @@ can_handle_critical( const byte *buffer, size_t n, int type ) switch( type ) { case SIGSUBPKT_NOTATION: - if( n >= 8 && (*buffer & 0x80) ) - return 1; /* human readable is handled */ - return 0; - + if(n>=8) + return can_handle_critical_notation(buffer+8,(buffer[4]<<8)|buffer[5]); + else + return 0; case SIGSUBPKT_SIGNATURE: case SIGSUBPKT_SIG_CREATED: case SIGSUBPKT_SIG_EXPIRE: |