diff options
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r-- | g10/build-packet.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c index 0a4d97d8a..e24ac3b2a 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -706,6 +706,10 @@ build_sig_subpkt (PKT_signature *sig, sigsubpkttype_t type, critical = (type & SIGSUBPKT_FLAG_CRITICAL); type &= ~SIGSUBPKT_FLAG_CRITICAL; + /* Sanity check buffer sizes */ + if(parse_one_sig_subpkt(buffer,buflen,type)<0) + BUG(); + switch(type) { case SIGSUBPKT_NOTATION: @@ -721,6 +725,36 @@ build_sig_subpkt (PKT_signature *sig, sigsubpkttype_t type, break; } + /* Any special magic that needs to be done for this type so the + packet doesn't need to be reparsed? */ + switch(type) + { + case SIGSUBPKT_NOTATION: + sig->flags.notation=1; + break; + + case SIGSUBPKT_POLICY: + sig->flags.policy_url=1; + break; + + case SIGSUBPKT_EXPORTABLE: + if(buffer[0]) + sig->flags.exportable=1; + else + sig->flags.exportable=0; + break; + + case SIGSUBPKT_REVOCABLE: + if(buffer[0]) + sig->flags.revocable=1; + else + sig->flags.revocable=0; + break; + + default: + break; + } + if( (buflen+1) >= 8384 ) nlen = 5; /* write 5 byte length header */ else if( (buflen+1) >= 192 ) |