diff options
| author | Patrick Steinhardt <ps@pks.im> | 2017-03-28 09:08:41 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-04-04 11:58:46 +0200 |
| commit | cffd616a7205d6b025f3736eb6c0a1ae9c3cd85d (patch) | |
| tree | df2d9286ca8083d0e2b2a90d4018d9a72b439cb3 /src/path.c | |
| parent | 4467aeac421efd04bc8c814541535c02853e9418 (diff) | |
| download | libgit2-cffd616a7205d6b025f3736eb6c0a1ae9c3cd85d.tar.gz | |
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.
Diffstat (limited to 'src/path.c')
| -rw-r--r-- | src/path.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c index c3d3eb1ce..9b15c8cf9 100644 --- a/src/path.c +++ b/src/path.c @@ -700,7 +700,8 @@ static bool _check_dir_contents( return false; /* save excursion */ - git_buf_joinpath(dir, dir->ptr, sub); + if (git_buf_joinpath(dir, dir->ptr, sub) < 0) + return false; result = predicate(dir->ptr); |
