• Jeff King's avatar
    test-path-utils: fix normalize_path_copy output buffer size · 62f17513
    Jeff King authored
    The normalize_path_copy function needs an output buffer that
    is at least as long as its input (it may shrink the path,
    but never expand it). However, this test program feeds it
    static PATH_MAX-sized buffers, which have no relation to the
    input size.
    
    In the normalize_ceiling_entry case, we do at least check
    the size against PATH_MAX and die(), but that case is even
    more convoluted. We normalize into a fixed-size buffer, free
    the original, and then replace it with a strdup'd copy of
    the result. But normalize_path_copy explicitly allows
    normalizing in-place, so we can simply do that.
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    62f17513
test-path-utils.c 6.99 KB