Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] git-mailinfo may corrupt patch headers on attached files

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:54

quoted hunk
I noticed this the other day, just never got a chance to send the fix out.
This might be the same problem I ran into.

Cheers,
Don

 builtin-mailinfo.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 2894e34..cedda18 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -795,7 +795,7 @@ static void handle_body(void)
 	int rc = 0;
 	static char newline[2000];
 	static char *np = newline;
-	int len = strlen(line);
+	int len;
 
 	/* Skip up to the first boundary */
 	if (content_top->boundary) {
@@ -814,6 +814,9 @@ static void handle_body(void)
 				return;
 		}
 
+		/* line may have changed after handling boundary, check len */
+		len = strlen(line);
+
 		/* Unwrap transfer encoding */
 		len = decode_transfer_encoding(line, sizeof(line), len);
 		if (len < 0) {
This does fix the "F\n" issue, but seems to break t5100 test ("respect
NULs").  I haven't looked into the details yet...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help