summaryrefslogtreecommitdiff
path: root/tag.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-21 01:20:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-21 18:12:52 (GMT)
commita1be47e4ca65718ec239e4b86a44e45220237aee (patch)
tree688e23ca3b924b229dbc2a8a94fdf4dab88ae294 /tag.c
parentc0f9c705890ac30871c70219c4b08d740fb40e2e (diff)
downloadgit-a1be47e4ca65718ec239e4b86a44e45220237aee.zip
git-a1be47e4ca65718ec239e4b86a44e45220237aee.tar.gz
git-a1be47e4ca65718ec239e4b86a44e45220237aee.tar.bz2
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 'tag.c')
0 files changed, 0 insertions, 0 deletions