Re: [PATCH] mingw: do not crash on open(NULL, ...)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Erik Faye-Lund <kusmabite@xxxxxxxxx> writes:

> On Thu, Sep 23, 2010 at 10:35 AM, Erik Faye-Lund <kusmabite@xxxxxxxxx> wrote:
>> Since open() already sets errno correctly for the NULL-case, let's just
>> avoid the problematic strcmp.
>>
>> Signed-off-by: Erik Faye-Lund <kusmabite@xxxxxxxxx>
>
> 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.

Surely, open(NULL) should be rejected by a sane system, and your patch
looks sane to me.

But depending on and exploiting the fact sounds like a horrible hack in
the caller of parse_pack_index(..., NULL) to me.

Shawn may have intentionally done that in 750ef42 (http-fetch: Use
temporary files for pack-*.idx until verified, 2010-04-19), but at least
7b64469 (Allow parse_pack_index on temporary files, 2010-04-19) should
have documented that idx_path is allowed to be NULL under what
circumstance (and for what purpose it is useful to do so) when it
introduced the second parameter to the API.

What were we smoking?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]