Re: git-send-email.perl defect: address missing trailing > accepted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2009-10-21 at 00:29 +0200, Erik Faye-Lund wrote:
> On Wed, Oct 21, 2009 at 12:12 AM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> > I typo cut/pasted an invalid email address,
> > neglecting to copy the trailing ">".
> > was:    "Name <addr.org"
> > needed: "Name <addr.org>"
> > Anyone have suggestions on how to get
> > git-send-email.perl to notify and abort
> > sending on more invalid address styles?
> 
> Something along these lines? Of course, the error message is, uhm,
> less than helpful :)
> 
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -787,6 +787,10 @@ sub is_rfc2047_quoted {
>  sub sanitize_address
>  {
>  	my ($recipient) = @_;
> +	if ($recipient =~ m/.*<[^>]*$/) {
> +		die "EEK!"
> +	}
> +


Maybe this?  Seems to work.

diff --git a/git-send-email.perl b/git-send-email.perl
index a0279de..52ddd9e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -374,15 +374,18 @@ my ($repoauthor, $repocommitter);
 # Verify the user input
 
 foreach my $entry (@to) {
-	die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
+	die "Comma in --to entry: '$entry'\n" unless $entry !~ m/,/;
+	die "Invalid --to entry: '$entry'\n"  unless $entry !~ m/.*<[^>]*$/;
 }
 
 foreach my $entry (@initial_cc) {
-	die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/;
+	die "Comma in --cc entry: '$entry'\n" unless $entry !~ m/,/;
+	die "Invalid --cc entry: '$entry'\n" unless $entry !~ m/.*<[^>]*$/;
 }
 
 foreach my $entry (@bcclist) {
-	die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/;
+	die "Comma in --bcclist entry: '$entry'\n" unless $entry !~ m/,/;
+	die "Invalid --bcclist entry: '$entry'\n" unless $entry !~ m/.*<[^>]*$/;
 }
 
 sub parse_address_line {


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]