]> git.ipfire.org Git - thirdparty/git.git/commit
unpack-trees: avoid array out-of-bounds error
authorDerrick Stolee <dstolee@microsoft.com>
Thu, 7 May 2020 13:17:33 +0000 (13:17 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 May 2020 18:01:27 +0000 (11:01 -0700)
commit0eeb3be4c4b297f9edb94c4741af606df396985d
tree3e159228047fe3c644fd69e209d74867843a81f2
parent5644ca28cded68972c74614fc06d6e0e1db1a7de
unpack-trees: avoid array out-of-bounds error

The loop in warn_conflicted_path() that checks for the count of
entries with the same path uses "i+count" for the array
entry. However, the loop only verifies that the value of count is
below the array size. Fix this by adding i to the condition.

I hit this condition during a test of the in-tree sparse-checkout
feature, so it is exercised by the end of the series.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
[jc: readability fix]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c