Re: Re: [PATCH] mingw: do not crash on open(NULL, ...)
- From
Pat Thoyts <patthoyts@gmail.com>
- Date
- Sep 23, 2010, 20:27 UTC
- Message-ID
- <AANLkTimviqUqcy40aR=DC--tqKHWXfX9gLMoX7tyjafe@mail.gmail.com>
- In-Reply-To
- <AANLkTinJ4kKRsKO6HyqQH4Oy12E1mdqCXxPb2z+59818@mail.gmail.com>
(Apparently gmail on a phone insists on top posting) It looks like this problem was missed by the test suite. Any chance of a test as well? Got to catch those regressions.
On 23 Sep 2010 19:00, "Erik Faye-Lund" <kusmabite@gmail.com> wrote:
> On Thu, Sep 23, 2010 at 10:35 AM, Erik Faye-Lund <kusmabite@gmail.com>
wrote:
Show 17 quoted lines
>> Since open() already sets errno correctly for the NULL-case, let's just >> avoid the problematic strcmp. >> >> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> > > I guess I should add a comment as to why this patch is needed: > > This seems to be the culprit for issue 523 in the msysGit issue > tracker: http://code.google.com/p/msysgit/issues/detail?id=523 > > fetch_and_setup_pack_index() apparently pass a NULL-pointer to > parse_pack_index(), which in turn pass it to check_packed_git_idx(), > which again pass it to open(). This all looks intentional to my > (http.c-untrained) eye. > > The code in mingw_open was introduced in commit 3e4a1ba (by Johannes > Sixt), and the lack of a NULL-check looks like a simple oversight.