From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: [PATCH v2 1/2] send-email: sanitize author when writing From line Date: Thu, 20 Jun 2013 15:27:08 +0300 Message-ID: <1371731166-24015-1-git-send-email-mst@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: =?us-ascii?B?PT9VVEYtOD9xP1NaRURFUj0yMEc9QzM9QTFib3I/PQ==?= To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Thu Jun 20 14:26:40 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Updwh-00019T-Of for gcvg-git-2@plane.gmane.org; Thu, 20 Jun 2013 14:26:36 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757744Ab3FTM0b convert rfc822-to-quoted-printable (ORCPT ); Thu, 20 Jun 2013 08:26:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7528 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753085Ab3FTM0a (ORCPT ); Thu, 20 Jun 2013 08:26:30 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5KCQMdu014911 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 20 Jun 2013 08:26:23 -0400 Received: from redhat.com (vpn-200-33.tlv.redhat.com [10.35.200.33]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5KCQKwY000568; Thu, 20 Jun 2013 08:26:21 -0400 Content-Disposition: inline X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: sender is now sanitized, but we didn't sanitize author when checking whether From: line is needed in the message body. As a result git started writing duplicate From lines when author matched sender and has utf8 characters. Reported-by: SZEDER G=E1bor Tested-by: SZEDER G=E1bor Signed-off-by: Michael S. Tsirkin --- git-send-email.perl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 671762b..ecbf56f 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1259,6 +1259,7 @@ foreach my $t (@files) { open my $fh, "<", $t or die "can't open file $t"; =20 my $author =3D undef; + my $sauthor =3D undef; my $author_encoding; my $has_content_type; my $body_encoding; @@ -1297,7 +1298,7 @@ foreach my $t (@files) { } elsif (/^From:\s+(.*)$/i) { ($author, $author_encoding) =3D unquote_rfc2047($1); - my $sauthor =3D sanitize_address($author); + $sauthor =3D sanitize_address($author); next if $suppress_cc{'author'}; next if $suppress_cc{'self'} and $sauthor eq $sender; printf("(mbox) Adding cc: %s from line '%s'\n", @@ -1393,7 +1394,7 @@ foreach my $t (@files) { $subject =3D quote_subject($subject, $auto_8bit_encoding); } =20 - if (defined $author and $author ne $sender) { + if (defined $sauthor and $sauthor ne $sender) { $message =3D "From: $author\n\n$message"; if (defined $author_encoding) { if ($has_content_type) { --=20 MST