libgit2 config opts: set the search to an empty path
Otherwise this would search outside the unveiled paths and cause an unveil violation. Reported by Anton Lindqvist, thanks!
2 files changed, 8 insertions(+), 0 deletions(-) | |||
---|---|---|---|
M | stagit-index.c | +4 | -0 |
M | stagit.c | +4 | -0 |
1@@ -173,7 +173,11 @@ main(int argc, char *argv[])
2 return 1;
3 }
4
5+ /* do not search outside the git repository:
6+ GIT_CONFIG_LEVEL_APP is the highest level currently */
7 git_libgit2_init();
8+ for (i = 1; i <= GIT_CONFIG_LEVEL_APP; i++)
9+ git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, i, "");
10
11 #ifdef __OpenBSD__
12 if (pledge("stdio rpath", NULL) == -1)
M · stagit.c
+4, -0 1@@ -1220,7 +1220,11 @@ main(int argc, char *argv[])
2 if (!realpath(repodir, repodirabs))
3 err(1, "realpath");
4
5+ /* do not search outside the git repository:
6+ GIT_CONFIG_LEVEL_APP is the highest level currently */
7 git_libgit2_init();
8+ for (i = 1; i <= GIT_CONFIG_LEVEL_APP; i++)
9+ git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, i, "");
10
11 #ifdef __OpenBSD__
12 if (unveil(repodir, "r") == -1)