1
0
mirror of https://github.com/git/git.git synced 2024-09-24 23:21:35 +02:00
git/builtin
Jeff King fcd12db6af prefer git_pathdup to git_path in some possibly-dangerous cases
Because git_path uses a static buffer that is shared with
calls to git_path, mkpath, etc, it can be dangerous to
assign the result to a variable or pass it to a non-trivial
function. The value may change unexpectedly due to other
calls.

None of the cases changed here has a known bug, but they're
worth converting away from git_path because:

  1. It's easy to use git_pathdup in these cases.

  2. They use constructs (like assignment) that make it
     hard to tell whether they're safe or not.

The extra malloc overhead should be trivial, as an
allocation should be an order of magnitude cheaper than a
system call (which we are clearly about to make, since we
are constructing a filename). The real cost is that we must
remember to free the result.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-10 15:37:12 -07:00
..
add.c Merge branch 'nd/diff-i-t-a' 2015-06-25 10:47:46 -07:00
annotate.c
apply.c Merge branch 'jc/apply-reject-noop-hunk' 2015-06-24 12:21:39 -07:00
archive.c
bisect--helper.c
blame.c Merge branch 'jk/date-mode-format' 2015-08-03 11:01:27 -07:00
branch.c
bundle.c
cat-file.c cat-file: sort and de-dup output of --batch-all-objects 2015-06-26 09:24:42 -07:00
check-attr.c
check-ignore.c
check-mailmap.c
check-ref-format.c
checkout-index.c
checkout.c Merge branch 'dt/refs-backend-preamble' 2015-08-03 11:01:29 -07:00
clean.c
clone.c Merge branch 'mh/init-delete-refs-api' 2015-08-03 11:01:17 -07:00
column.c
commit-tree.c
commit.c convert "enum date_mode" into a struct 2015-06-29 11:39:07 -07:00
config.c
count-objects.c
credential.c
describe.c
diff-files.c
diff-index.c
diff-tree.c
diff.c
fast-export.c
fetch-pack.c
fetch.c
fmt-merge-msg.c
for-each-ref.c for-each-ref: introduce filter_refs() 2015-08-03 10:24:07 -07:00
fsck.c prefer git_pathdup to git_path in some possibly-dangerous cases 2015-08-10 15:37:12 -07:00
gc.c Merge branch 'nd/multiple-work-trees' 2015-07-13 14:02:02 -07:00
get-tar-commit-id.c
grep.c
hash-object.c
help.c
index-pack.c Merge branch 'js/fsck-opt' 2015-08-03 11:01:18 -07:00
init-db.c
interpret-trailers.c
log.c Merge branch 'jk/date-mode-format' 2015-08-03 11:01:27 -07:00
ls-files.c
ls-remote.c
ls-tree.c
mailinfo.c
mailsplit.c
merge-base.c
merge-file.c
merge-index.c
merge-ours.c
merge-recursive.c
merge-tree.c
merge.c
mktag.c
mktree.c
mv.c
name-rev.c
notes.c
pack-objects.c parse-options: move unsigned long option parsing out of pack-objects.c 2015-06-22 15:07:21 -07:00
pack-redundant.c
pack-refs.c
patch-id.c
prune-packed.c
prune.c Merge branch 'nd/multiple-work-trees' 2015-07-13 14:02:02 -07:00
pull.c
push.c
read-tree.c
receive-pack.c Merge branch 'jx/do-not-crash-receive-pack-wo-head' 2015-08-03 11:01:31 -07:00
reflog.c git-reflog: add exists command 2015-07-21 14:08:14 -07:00
remote-ext.c
remote-fd.c
remote.c
repack.c
replace.c Merge branch 'mh/replace-refs' 2015-08-03 11:01:10 -07:00
rerere.c
reset.c
rev-list.c Merge branch 'ls/hint-rev-list-count' 2015-07-10 14:26:13 -07:00
rev-parse.c rev-parse --parseopt: allow [*=?!] in argument hints 2015-07-15 10:30:54 -07:00
revert.c
rm.c
send-pack.c builtin/send-pack.c: respect user.signingkey 2015-07-21 15:24:27 -07:00
shortlog.c convert "enum date_mode" into a struct 2015-06-29 11:39:07 -07:00
show-branch.c convert "enum date_mode" into a struct 2015-06-29 11:39:07 -07:00
show-ref.c
stripspace.c
symbolic-ref.c
tag.c update-ref and tag: add --create-reflog arg 2015-07-21 14:08:35 -07:00
unpack-file.c
unpack-objects.c fsck (receive-pack): allow demoting errors to warnings 2015-06-23 14:27:34 -07:00
update-index.c
update-ref.c Merge branch 'dt/refs-backend-preamble' 2015-08-03 11:01:29 -07:00
update-server-info.c
upload-archive.c
var.c
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c Merge branch 'es/worktree-add' 2015-07-13 14:02:19 -07:00
write-tree.c