Skip to content

Commit 8a349bf

Browse files
committed
ignore: there must be a repository
Otherwise we'll NULL-dereference in git_attr_cache__init
1 parent a6d833a commit 8a349bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ignore.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ int git_ignore__for_path(
278278
int error = 0;
279279
const char *workdir = git_repository_workdir(repo);
280280

281-
assert(ignores && path);
281+
assert(repo && ignores && path);
282282

283283
memset(ignores, 0, sizeof(*ignores));
284284
ignores->repo = repo;
@@ -503,9 +503,9 @@ int git_ignore_path_is_ignored(
503503
unsigned int i;
504504
git_attr_file *file;
505505

506-
assert(ignored && pathname);
506+
assert(repo && ignored && pathname);
507507

508-
workdir = repo ? git_repository_workdir(repo) : NULL;
508+
workdir = git_repository_workdir(repo);
509509

510510
memset(&path, 0, sizeof(path));
511511
memset(&ignores, 0, sizeof(ignores));

0 commit comments

Comments
 (0)