From: Eric Sunshine <sunshine@sunshineco.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/4] archive-tar: fix pax extended header length calculation
Date: Sat, 17 Aug 2019 14:03:14 -0400 [thread overview]
Message-ID: <CAPig+cRi5uUKHGNB+DezAMaQ6R27U-5Xyy3bUE2c=W0CoyPkVQ@mail.gmail.com> (raw)
In-Reply-To: <4b04cf3f-966a-3aa9-6a30-7ac3a234e1ed@web.de>
On Sat, Aug 17, 2019 at 12:24 PM René Scharfe <l.s.r@web.de> wrote:
> A pax extended header records starts with a decimal number. Its value
s/records/record/
> is the length of the whole record, including its own length.
>
> The calculation of that number if strbuf_append_ext_header() is off by
s/if/in/
> one in case the length of the rest is close to a higher order of
> magnitude. This affects paths and link targets a bit shorter than 1000,
> 10000, 100000 etc. characters -- paths with a length of up to 100 fit
> into the tar header and don't need a pax extended header.
>
> The mistake has been present since the function was added by ae64bbc18c
> ("tar-tree: Introduce write_entry()", 2006-03-25).
>
> Account for digits added to len during the loop and keep incrementing
> until we have enough space for len and the rest. The crucial change is
> to check against the current value of len before each iteration, instead
> of against its value before the loop.
>
> Signed-off-by: René Scharfe <l.s.r@web.de>
next prev parent reply other threads:[~2019-08-17 18:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-17 16:19 [PATCH 0/4] fix pax extended header length calculation René Scharfe
2019-08-17 16:23 ` [PATCH 1/4] archive-tar: report wrong pax extended header length René Scharfe
2019-08-17 16:24 ` [PATCH 2/4] archive-tar: fix pax extended header length calculation René Scharfe
2019-08-17 18:03 ` Eric Sunshine [this message]
2019-08-17 16:24 ` [PATCH 3/4] archive-tar: use size_t in strbuf_append_ext_header() René Scharfe
2019-08-17 16:24 ` [PATCH 4/4] archive-tar: turn length miscalculation warning into BUG René Scharfe
2019-08-17 16:40 ` [PATCH 0/4] fix pax extended header length calculation brian m. carlson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPig+cRi5uUKHGNB+DezAMaQ6R27U-5Xyy3bUE2c=W0CoyPkVQ@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).