@matheusbsbs / matheus-bagliano / commits / 87f1b8849b
Fork 0

mailinfo: feed only one line to handle_filter() for QP input

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>

Jay Soffian committed Feb 15, 2008 at 16:53 UTC 87f1b8849bf0094e0b20cd294e1f2b04976ddf41
6 files changed +45 -1
builtin-mailinfo.c
+1
@@ -818,6 +818,7 @@ static void handle_body(void)
818
819 switch (transfer_encoding) {
820 case TE_BASE64:
821 + case TE_QP:
822 {
823 char *op = line;
824
t/t5100-mailinfo.sh
+1 -1
@@ -11,7 +11,7 @@ test_expect_success 'split sample box' \
11 'git mailsplit -o. ../t5100/sample.mbox >last &&
12 last=`cat last` &&
13 echo total is $last &&
14 - test `cat last` = 8'
14 + test `cat last` = 9'
15
16 for mail in `echo 00*`
17 do
t/t5100/info0009 new
+5
@@ -0,0 +1,5 @@
1 +Author: F U Bar
2 +Email: f.u.bar@example.com
3 +Subject: updates
4 +Date: Mon, 17 Sep 2001 00:00:00 +0900
5 +
t/t5100/msg0009 new
+2
@@ -0,0 +1,2 @@
1 +This is to fix diff-format documentation.
2 +
t/t5100/patch0009 new
+13
@@ -0,0 +1,13 @@
1 +diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
2 +index b426a14..97756ec 100644
3 +--- a/Documentation/diff-format.txt
4 ++++ b/Documentation/diff-format.txt
5 +@@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
6 + environment variable 'GIT_DIFF_OPTS'. For example, if you
7 + prefer context diff:
8 +
9 +- GIT_DIFF_OPTS=-c git-diff-index -p $(cat .git/HEAD)
10 ++ GIT_DIFF_OPTS=-c git-diff-index -p HEAD
11 +
12 +
13 + 2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
t/t5100/sample.mbox
+23
@@ -407,3 +407,26 @@ Subject: [PATCH] another patch
407
408 Hey you forgot the patch!
409
410 +From nobody Mon Sep 17 00:00:00 2001
411 +From: A U Thor <a.u.thor@example.com>
412 +Date: Mon, 17 Sep 2001 00:00:00 +0900
413 +Mime-Version: 1.0
414 +Content-Type: Text/Plain; charset=us-ascii
415 +Content-Transfer-Encoding: Quoted-Printable
416 +
417 +=0A=0AFrom: F U Bar <f.u.bar@example.com>
418 +Subject: [PATCH] updates=0A=0AThis is to fix diff-format documentation.
419 +
420 +diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
421 +index b426a14..97756ec 100644
422 +--- a/Documentation/diff-format.txt
423 ++++ b/Documentation/diff-format.txt
424 +@@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
425 + environment variable 'GIT_DIFF_OPTS'. For example, if you
426 + prefer context diff:
427 +=20
428 +- GIT_DIFF_OPTS=3D-c git-diff-index -p $(cat .git/HEAD)
429 ++ GIT_DIFF_OPTS=3D-c git-diff-index -p HEAD
430 +=20
431 +=20
432 + 2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the