1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Fix bug#1087.

This commit is contained in:
Werner Koch 2009-07-16 07:40:16 +00:00
parent bdc004bafe
commit 81d7fbc7cb
2 changed files with 17 additions and 2 deletions

View file

@ -1132,6 +1132,16 @@ unescape_percent_string (const unsigned char *s)
}
/* Check whether the string has characters not valid in an RFC-822
address. To cope with OpenPGP we ignore non-ascii characters
so that for example umlauts are legal in an email address. An
OpenPGP user ID must be utf-8 encoded but there is no strict
requirement for RFC-822. Thus to avoid IDNA encoding we put the
address verbatim as utf-8 into the user ID under the assumption
that mail programs handle IDNA at a lower level and take OpenPGP
user IDs as utf-8. Note that we can't do an utf-8 encoding
checking here because in keygen.c this function is called with the
native encoding and native to utf-8 encoding is only done later. */
int
has_invalid_email_chars (const char *s)
{
@ -1142,7 +1152,7 @@ has_invalid_email_chars (const char *s)
for ( ; *s; s++ )
{
if ( *s & 0x80 )
return 1;
continue; /* We only care about ASCII. */
if ( *s == '@' )
at_seen=1;
else if ( !at_seen && !( !!strchr( valid_chars, *s ) || *s == '+' ) )