diff options
author | Jeff King <peff@peff.net> | 2013-04-05 17:15:50 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-06 18:57:15 -0700 |
commit | aaa07e3eee6f42d0adeac826dfb52d5ade26defc (patch) | |
tree | 0a188f1f8321dce9fe433eba70b8598669a4f77d /t/t5511-refspec.sh | |
parent | Git 1.8.0.3 (diff) | |
download | tgif-aaa07e3eee6f42d0adeac826dfb52d5ade26defc.tar.xz |
show-branch: use strbuf instead of static buffer
When we generate relative names (e.g., "master~20^2"), we
format the name into a static buffer, then xstrdup the
result to attach it to the commit. Since the first thing we
add into the static buffer is the already-computed name of
the child commit, the names may get longer and longer as
the traversal gets deeper, and we may eventually overflow
the fixed-size buffer.
Fix this by converting the fixed-size buffer into a dynamic
strbuf. The performance implications should be minimal, as
we end up allocating a heap copy of the name anyway (and now
we can just detach the heap copy from the strbuf).
Reported-by: Eric Roman <eroman@chromium.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5511-refspec.sh')
0 files changed, 0 insertions, 0 deletions