diff options
author | Jeff King <peff@peff.net> | 2017-03-20 21:20:42 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-21 11:12:52 -0700 |
commit | a1be47e4ca65718ec239e4b86a44e45220237aee (patch) | |
tree | 688e23ca3b924b229dbc2a8a94fdf4dab88ae294 /trace.h | |
parent | Sync with 2.12.1 (diff) | |
download | tgif-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 'trace.h')
0 files changed, 0 insertions, 0 deletions