• J
    read_info_alternates: handle paths larger than PATH_MAX · 5015f01c
    Jeff King 提交于
    This function assumes that the relative_base path passed
    into it is no larger than PATH_MAX, and writes into a
    fixed-size buffer. However, this path may not have actually
    come from the filesystem; for example, add_submodule_odb
    generates a path using a strbuf and passes it in. This is
    hard to trigger in practice, though, because the long
    submodule directory would have to exist on disk before we
    would try to open its info/alternates file.
    
    We can easily avoid the bug, though, by simply creating the
    filename on the heap.
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    5015f01c
sha1_file.c 85.1 KB