git/builtin
Jeff King 594fa9998c odb_mkstemp: write filename into strbuf
The odb_mkstemp() function expects the caller to provide a
fixed buffer to write the resulting tempfile name into. But
it creates the template using snprintf without checking the
return value. This means we could silently truncate the
filename.

In practice, it's unlikely that the truncation would end in
the template-pattern that mkstemp needs to open the file. So
we'd probably end up failing either way, unless the path was
specially crafted.

The simplest fix would be to notice the truncation and die.
However, we can observe that most callers immediately
xstrdup() the result anyway. So instead, let's switch to
using a strbuf, which is easier for them (and isn't a big
deal for the other 2 callers, who can just strbuf_release
when they're done with it).

Note that many of the callers used static buffers, but this
was purely to avoid putting a large buffer on the stack. We
never passed the static buffers out of the function, so
there's no complicated memory handling we need to change.

Signed-off-by: Jeff King <peff@peff.net>
2017-03-28 15:28:04 -07:00
..
add.c
am.c
annotate.c
apply.c
archive.c
bisect--helper.c
blame.c Merge branch 'rs/blame-code-cleanup' 2017-03-17 13:50:24 -07:00
branch.c Merge branch 'bc/object-id' 2017-03-17 13:50:25 -07:00
bundle.c bundle: use prefix_filename with bundle path 2017-03-21 11:18:41 -07:00
cat-file.c
check-attr.c
check-ignore.c
check-mailmap.c
check-ref-format.c
checkout-index.c
checkout.c Merge branch 'sb/checkout-recurse-submodules' 2017-03-28 14:05:58 -07:00
clean.c
clone.c
column.c
commit-tree.c
commit.c
config.c prefix_filename: return newly allocated string 2017-03-21 11:18:41 -07:00
count-objects.c
credential.c
describe.c builtin/describe: introduce --broken flag 2017-03-22 10:13:41 -07:00
diff-files.c
diff-index.c
diff-tree.c Merge branch 'bc/object-id' 2017-03-17 13:50:25 -07:00
diff.c
difftool.c difftool: handle modified symlinks in dir-diff mode 2017-03-15 12:08:10 -07:00
fast-export.c
fetch-pack.c
fetch.c
fmt-merge-msg.c
for-each-ref.c
fsck.c
gc.c Merge branch 'cc/split-index-config' 2017-03-17 13:50:23 -07:00
get-tar-commit-id.c
grep.c Merge branch 'sb/checkout-recurse-submodules' 2017-03-28 14:05:58 -07:00
hash-object.c prefix_filename: return newly allocated string 2017-03-21 11:18:41 -07:00
help.c
index-pack.c odb_mkstemp: write filename into strbuf 2017-03-28 15:28:04 -07:00
init-db.c real_pathdup(): fix callsites that wanted it to die on error 2017-03-08 14:38:41 -08:00
interpret-trailers.c
log.c prefix_filename: return newly allocated string 2017-03-21 11:18:41 -07:00
ls-files.c
ls-remote.c
ls-tree.c
mailinfo.c prefix_filename: return newly allocated string 2017-03-21 11:18:41 -07:00
mailsplit.c
merge-base.c
merge-file.c prefix_filename: return newly allocated string 2017-03-21 11:18:41 -07:00
merge-index.c
merge-ours.c
merge-recursive.c
merge-tree.c
merge.c Merge branch 'bc/object-id' 2017-03-17 13:50:25 -07:00
mktag.c
mktree.c
mv.c
name-rev.c
notes.c Merge branch 'bc/object-id' 2017-03-17 13:50:25 -07:00
pack-objects.c Merge branch 'jk/fast-import-cleanup' 2017-03-28 14:05:59 -07:00
pack-redundant.c
pack-refs.c
patch-id.c
prune-packed.c
prune.c
pull.c
push.c
read-tree.c builtin/read-tree: add --recurse-submodules switch 2017-03-16 14:07:16 -07:00
rebase--helper.c
receive-pack.c Merge branch 'rs/update-hook-optim' 2017-03-24 13:07:37 -07:00
reflog.c
remote-ext.c
remote-fd.c
remote.c Merge branch 'rl/remote-allow-missing-branch-name-merge' into maint 2017-03-21 15:03:28 -07:00
repack.c
replace.c Merge branch 'bc/object-id' 2017-03-17 13:50:25 -07:00
rerere.c
reset.c
rev-list.c
rev-parse.c Merge branch 'jk/prefix-filename' 2017-03-27 10:59:26 -07:00
revert.c Merge branch 'jk/cherry-pick-0-mainline' 2017-03-17 13:50:28 -07:00
rm.c
send-pack.c remote-curl: allow push options 2017-03-22 15:41:21 -07:00
shortlog.c Merge branch 'rs/shortlog-cleanup' 2017-03-24 13:07:37 -07:00
show-branch.c Merge branch 'jk/show-branch-lift-name-len-limit' into maint 2017-03-21 15:03:29 -07:00
show-ref.c
stripspace.c
submodule--helper.c Merge branch 'sb/checkout-recurse-submodules' 2017-03-28 14:05:58 -07:00
symbolic-ref.c
tag.c
unpack-file.c
unpack-objects.c
update-index.c
update-ref.c
update-server-info.c
upload-archive.c
var.c
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c prefix_filename: return newly allocated string 2017-03-21 11:18:41 -07:00
write-tree.c