Skip to content

Commit cffd616

Browse files
committed
path: handle error returned by git_buf_joinpath
In the `_check_dir_contents` function, we first allocate memory for joining the directory and subdirectory together and afterwards use `git_buf_joinpath`. While this function in fact should not fail as memory is already allocated, err on the safe side and check for returned errors.
1 parent 4467aea commit cffd616

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/path.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,8 @@ static bool _check_dir_contents(
700700
return false;
701701

702702
/* save excursion */
703-
git_buf_joinpath(dir, dir->ptr, sub);
703+
if (git_buf_joinpath(dir, dir->ptr, sub) < 0)
704+
return false;
704705

705706
result = predicate(dir->ptr);
706707

0 commit comments

Comments
 (0)