git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2008, 00:09 UTC
Message-ID
<7vej66blmc.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1215379261-10802-1-git-send-email-dzickus@redhat.com>
Show 32 quoted lines
> 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...

Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 7 in “'git am' breakage with MIME decoding”
  1. Linus TorvaldsJul 6, 2008
  2. git-mailinfo may corrupt patch headers on attached filesDon Zickus, Jul 6, 2008
  3. Linus TorvaldsJul 6, 2008
  4. Junio C HamanoJul 6, 2008
  5. Junio C HamanoJul 7, 2008
  6. Junio C HamanoJul 7, 2008
  7. Don ZickusJul 7, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.