зеркало из https://github.com/microsoft/git.git
pathspec: fix segfault in clear_pathspec
In 'clear_pathspec()' the incorrect index parameter is used to bound an inner-loop which is used to free a 'struct attr_match' value field. Using the incorrect index parameter (in addition to being incorrect) occasionally causes segmentation faults when attempting to free an invalid pointer. Fix this by using the correct index parameter 'i'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
c5af19f9ab
Коммит
5ce10c0a29
|
@ -724,7 +724,7 @@ void clear_pathspec(struct pathspec *pathspec)
|
|||
free(pathspec->items[i].match);
|
||||
free(pathspec->items[i].original);
|
||||
|
||||
for (j = 0; j < pathspec->items[j].attr_match_nr; j++)
|
||||
for (j = 0; j < pathspec->items[i].attr_match_nr; j++)
|
||||
free(pathspec->items[i].attr_match[j].value);
|
||||
free(pathspec->items[i].attr_match);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче