Skip to content

Commit

Permalink
mailinfo: feed only one line to handle_filter() for QP input
Browse files Browse the repository at this point in the history
The function is intended to be fed one logical line at a time to
inspect, but a QP encoded raw input line can have more than one
lines, just like BASE64 encoded one.

Quoting LF as =0A may be unusual but RFC2045 allows it.

The issue was noticed and fixed by Jay Soffian.  JC added a test
to protect the fix from regressing later.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jay Soffian authored and Junio C Hamano committed Feb 16, 2008
1 parent b20a60d commit 87f1b88
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions builtin-mailinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ static void handle_body(void)

switch (transfer_encoding) {
case TE_BASE64:
case TE_QP:
{
char *op = line;

Expand Down
2 changes: 1 addition & 1 deletion t/t5100-mailinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test_expect_success 'split sample box' \
'git mailsplit -o. ../t5100/sample.mbox >last &&
last=`cat last` &&
echo total is $last &&
test `cat last` = 8'
test `cat last` = 9'

for mail in `echo 00*`
do
Expand Down
5 changes: 5 additions & 0 deletions t/t5100/info0009
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Author: F U Bar
Email: f.u.bar@example.com
Subject: updates
Date: Mon, 17 Sep 2001 00:00:00 +0900

2 changes: 2 additions & 0 deletions t/t5100/msg0009
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is to fix diff-format documentation.

13 changes: 13 additions & 0 deletions t/t5100/patch0009
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
index b426a14..97756ec 100644
--- a/Documentation/diff-format.txt
+++ b/Documentation/diff-format.txt
@@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
environment variable 'GIT_DIFF_OPTS'. For example, if you
prefer context diff:

- GIT_DIFF_OPTS=-c git-diff-index -p $(cat .git/HEAD)
+ GIT_DIFF_OPTS=-c git-diff-index -p HEAD


2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
23 changes: 23 additions & 0 deletions t/t5100/sample.mbox
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,26 @@ Subject: [PATCH] another patch

Hey you forgot the patch!

From nobody Mon Sep 17 00:00:00 2001
From: A U Thor <a.u.thor@example.com>
Date: Mon, 17 Sep 2001 00:00:00 +0900
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: Quoted-Printable
=0A=0AFrom: F U Bar <f.u.bar@example.com>
Subject: [PATCH] updates=0A=0AThis is to fix diff-format documentation.
diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
index b426a14..97756ec 100644
--- a/Documentation/diff-format.txt
+++ b/Documentation/diff-format.txt
@@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
environment variable 'GIT_DIFF_OPTS'. For example, if you
prefer context diff:
=20
- GIT_DIFF_OPTS=3D-c git-diff-index -p $(cat .git/HEAD)
+ GIT_DIFF_OPTS=3D-c git-diff-index -p HEAD
=20
=20
2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the

0 comments on commit 87f1b88

Please sign in to comment.