diff options
author | Jeff King <peff@peff.net> | 2018-05-18 18:57:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-21 09:54:34 +0900 |
commit | d50b69b868d1b6a7f36e94382c74d2e8cda2d64a (patch) | |
tree | 420aeb61cdeb102be3e34b6209f45f320ea638b6 /t/t9131-git-svn-empty-symlink.sh | |
parent | http: use strbufs instead of fixed buffers (diff) | |
download | tgif-d50b69b868d1b6a7f36e94382c74d2e8cda2d64a.tar.xz |
log_write_email_headers: use strbufs
When we write a MIME attachment, we write the mime headers
into fixed-size buffers. These are likely to be big enough
in practice, but technically the input could be arbitrarily
large (e.g., if the caller provided a lot of content in the
extra_headers string), in which case we'd quietly truncate
it and generate bogus output. Let's convert these buffers to
strbufs.
The memory ownership here is a bit funny. The original fixed
buffers were static, and we merely pass out pointers to them
to be used by the caller (and in one case, we even just
stuff our value into the opt->diffopt.stat_sep value).
Ideally we'd actually pass back heap buffers, and the caller
would be responsible for freeing them.
This patch punts on that cleanup for now, and instead just
marks the strbufs as static. That means we keep ownership in
this function, making it not a complete leak. This also
takes us one step closer to fixing it in the long term
(since we can eventually use strbuf_detach() to hand
ownership to the caller, once it's ready).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9131-git-svn-empty-symlink.sh')
0 files changed, 0 insertions, 0 deletions