diff options
author | Werner Koch <[email protected]> | 1999-01-24 17:16:40 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1999-01-24 17:16:40 +0000 |
commit | a16e15282a0d75b4843f009a49fe1a20de9b7980 (patch) | |
tree | 86ec101fa56b80f4f3c93a69acfda0be92a84a52 /g10/parse-packet.c | |
parent | See ChangeLog: Thu Jan 21 06:22:10 CET 1999 Werner Koch (diff) | |
download | gnupg-a16e15282a0d75b4843f009a49fe1a20de9b7980.tar.gz gnupg-a16e15282a0d75b4843f009a49fe1a20de9b7980.zip |
See ChangeLog: Sun Jan 24 18:16:26 CET 1999 Werner Koch
Diffstat (limited to 'g10/parse-packet.c')
-rw-r--r-- | g10/parse-packet.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 53d8c7bfb..3c45a45b4 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1397,15 +1397,28 @@ parse_user_id( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) { byte *p; - packet->pkt.user_id = m_alloc(sizeof *packet->pkt.user_id + pktlen - 1); + packet->pkt.user_id = m_alloc(sizeof *packet->pkt.user_id + pktlen); packet->pkt.user_id->len = pktlen; p = packet->pkt.user_id->name; - for( ; pktlen; pktlen--, p++ ) + for( ; pktlen; pktlen--, p++ ) { *p = iobuf_get_noeof(inp); + /* 0xff is not a valid utf-8 encoding so we can use it to replace + * Nulls. This has the advantage that we can work with regular + * C strings. When exporting it, we change it back to Null + * the utf-8 functions know about this special convention. + * The advantage of this single character is that we can + * simple replace it. Problem is that we can't handle the 0xff + * character which may have been used by pref rfc2440 implementations + * I hope we can live with this. */ + if( !*p ) + *p = 0xff; + } + *p = 0; if( list_mode ) { int n = packet->pkt.user_id->len; printf(":user id packet: \""); + /* fixme: Hey why don't we replace this wioth print_string?? */ for(p=packet->pkt.user_id->name; n; p++, n-- ) { if( *p >= ' ' && *p <= 'z' ) putchar(*p); |