diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2017-05-22 16:17:35 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-23 14:29:52 +0900 |
commit | b9c8e7f2fb6ee19defeaa2927a0af42b525d8b33 (patch) | |
tree | 95c057da36e50b4b34fe9a48f538020c6fb85b7d /t/t5612-clone-refspec.sh | |
parent | files-backend: use `die("BUG: ...")`, not `die("internal error: ...")` (diff) | |
download | tgif-b9c8e7f2fb6ee19defeaa2927a0af42b525d8b33.tar.xz |
prefix_ref_iterator: don't trim too much
The `trim` parameter can be set independently of `prefix`. So if some
caller were to set `trim` to be greater than `strlen(prefix)`, we
could end up pointing the `refname` field of the iterator past the NUL
of the actual reference name string.
That can't happen currently, because `trim` is always set either to
zero or to `strlen(prefix)`. But even the latter could lead to
confusion, if a refname is exactly equal to the prefix, because then
we would set the outgoing `refname` to the empty string.
And we're about to decouple the `prefix` and `trim` arguments even
more, so let's be cautious here. Report a bug if ever asked to trim a
reference whose name is not longer than `trim`.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5612-clone-refspec.sh')
0 files changed, 0 insertions, 0 deletions