diff options
author | Jeff King <peff@peff.net> | 2015-09-24 17:07:49 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-05 11:08:05 -0700 |
commit | d4b3d11a03c5733a37656ca2f23171be6efad7d3 (patch) | |
tree | 1a4b9c14d274dc9da8eeffa85f142e9f28d011ac /sha1_name.c | |
parent | 4635768809885bb1c063bc9f9eee38e413f85f0d (diff) | |
download | git-d4b3d11a03c5733a37656ca2f23171be6efad7d3.tar.gz |
write_loose_object: convert to strbuf
When creating a loose object tempfile, we use a fixed
PATH_MAX-sized buffer, and strcpy directly into it. This
isn't buggy, because we do a rough check of the size, but
there's no verification that our guesstimate of the required
space is enough (in fact, it's several bytes too big for the
current naming scheme).
Let's switch to a strbuf, which makes this much easier to
verify. The allocation overhead should be negligible, since
we are replacing a static buffer with a static strbuf, and
we'll only need to allocate on the first call.
While we're here, we can also document a subtle interaction
with mkstemp that would be easy to overlook.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_name.c')
0 files changed, 0 insertions, 0 deletions