Subject: Re: [PATCH] send-email: add extra safetly in address sanitazion

From: Thomas Rast <[email-masked]>
Date: Sun, 5 Feb 2012 20:39:57 +0100

Felipe Contreras <[email-masked]> writes:

> Currently bad addresses like 'Foo Bar <[email-masked]>>' will just be sent
> verbatim -- that's not good; we should either error out, or sanitize
> them.
>
> The following patch adds extra sanitazion so the following
> transformations are performed:
>
>   'Foo Bar <[email-masked]>' -> 'Foo Bar <[email-masked]>'
>   '"Foo Bar" <[email-masked]>' -> '"Foo Bar" <[email-masked]>'
>   [email-masked]' -> [email-masked]'
>   '<[email-masked]>' -> [email-masked]'
>   'Foo Bar' -> 'Foo Bar'

Am I the only one who stared at this for ten seconds, only to then
realize that there is no sanitizing whatsoever going on here?

>   'Foo Bar <[email-masked]>>' -> 'Foo Bar <[email-masked]>'
>   '"Foo Bar" <[email-masked]>>' -> '"Foo Bar" <[email-masked]>'
>   '<[email-masked]>>' -> [email-masked]'

All of these are the same underlying issue.  Does your patch fix any
other malformed addresses, or just this particular type?

> Basically, we try to check that the address is in the form of
> "Name <email>", and if not, assume it's "email". According to commit
> 155197e[1], the "prhase" should not be empty, so if it is, remove the
                   ^^^^^^
"phrase"

>  git-send-email.perl |   14 ++++++++++----
>  1 files changed, 10 insertions(+), 4 deletions(-)

Tests?

-- 
Thomas Rast
trast@{inf,student}.ethz.ch