summaryrefslogtreecommitdiff
path: root/abspath.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-03-20 21:20:42 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-03-21 11:12:52 -0700
commita1be47e4ca65718ec239e4b86a44e45220237aee (patch)
tree688e23ca3b924b229dbc2a8a94fdf4dab88ae294 /abspath.c
parentSync with 2.12.1 (diff)
downloadtgif-a1be47e4ca65718ec239e4b86a44e45220237aee.tar.xz
hash-object: fix buffer reuse with --path in a subdirectory
The hash-object command uses prefix_filename() without duplicating its return value. Since that function returns a static buffer, the value is overwritten by subsequent calls. This can cause incorrect results when we use --path along with hashing a file by its relative path, both of which need to call prefix_filename(). We overwrite the filename computed for --path, effectively ignoring it. We can fix this by calling xstrdup on the return value. Note that we don't bother freeing the "vpath" instance, as it remains valid until the program exit. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'abspath.c')
0 files changed, 0 insertions, 0 deletions