All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: nguyenhu@minatec.inpg.fr
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCHv2] Possibility to read both from ~/.gitconfig and from $XDG_CONFIG_HOME/git/config
Date: Mon, 04 Jun 2012 18:27:47 +0100	[thread overview]
Message-ID: <4FCCF013.1020000@ramsay1.demon.co.uk> (raw)
In-Reply-To: <20120601214907.Horde.e8FjWXwdC4BPyRyzuIrz5oA@webmail.minatec.grenoble-inp.fr>

nguyenhu@minatec.inpg.fr wrote:
> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
>> I have not tried this patch (or the v3 version, which I haven't read  
>> yet), but
>> is it likely that this has re-introduced the bug addressed by commit 05bab3ea
>> ("config.c: Fix a static buffer overwrite bug by avoiding mkpath()",  
>>> 19-11-2011)?.
>> I don't know the answer, but I suspect that it may have done just  
>> that. >(indeed, it
>> may well have made the bug more likely to appear).
>>
>>
>>> The original that read from $HOME/.gitconfig was simple enough so
>>> having three copies of getenv("HOME") was perfectly fine, but as you
>>> are introduce this much complexity to to decide which two files to
>>> read from, the code added this patch needs to be refactored and
>>> three copies of the same logic need to be consolidated, I would have
>>> to say.
>> I agree. Also, using mksnpath() in the refactored code (rather than
>> mkpath()) would be a good idea. :-P
>>
>> ATB,
>> Ramsay Jones
> 
> Is not mkpath() the same function as mksnpath with char *buff =  
> buf[PATH_MAX] and size_t n = sizeof(buf) ?

I'm sorry but I just can't understand your question. :(

Have you looked at commit 05bab3ea? Is the commit message unclear?

The main difference between mkpath() and mksnpath(), as far as this bug
is concerned, is that mkpath() returns a reference to *recycled* internal
static buffers, whereas mksnpath() does not (you provide your own).

This evening I finally had a look at your patch, well v4 of the patch, and
I can confirm that it does indeed re-introduce the bug. I will reply to the
v4 patch email with more comments.

HTH

ATB,
Ramsay Jones

  reply	other threads:[~2012-06-04 17:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 19:49 [PATCHv2] Possibility to read both from ~/.gitconfig and from $XDG_CONFIG_HOME/git/config nguyenhu
2012-06-04 17:27 ` Ramsay Jones [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-31  8:46 nguyenhu
     [not found] <1338400509-26087-1-git-send-email-Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>
2012-05-30 21:19 ` Huynh Khoi Nguyen NGUYEN
2012-05-30 21:54   ` Junio C Hamano
2012-05-31 22:06     ` Ramsay Jones

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FCCF013.1020000@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nguyenhu@minatec.inpg.fr \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.