Re: [PATCH v2 01/21] path.c: avoid PATH_MAX as buffer size from get_pathname()
- From
Antoine Pelisse <apelisse@gmail.com>
- Date
- Dec 15, 2013, 09:33 UTC
- Message-ID
- <CALWbr2w-ibuoV5x3GGjJ3Lazeumdj7LhvnK+zfpWvyr10nc4Fw@mail.gmail.com>
- In-Reply-To
- <CACsJy8CVQfWdTY_aoH6uMTp0cgTnvF09tC7iLD7CjEL9d9=bzw@mail.gmail.com>
On Sun, Dec 15, 2013 at 10:02 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 12 quoted lines
> On Sun, Dec 15, 2013 at 3:35 PM, Torsten Bögershausen <tboegi@web.de> wrote: >> If we really want to go away from PATH_MAX, is a hard-coded value of 4096 so attractive ? >> Because we can either >> >> a) Re-define PATH_MAX in git-compat-util.h >> b) Use an own #define in git-compat-util.h, like e.g. GIT_PATH_MAX >> c) Change the code to use a "strbuf" which can grow on demand. >> >> I would prefer c) over b) over a) > > Looking at the code again, c) looks feasible after updating > git_snpath() to accept a strbuf instead of buffer/size pair.
I agree that this is probably the way to go. We are not trying to avoid PATH_MAX, but static-size array that can overflow.
Antoine,