libgit2 config opts: set the search to an empty path - stagit-gopher - A git gopher frontend. (mirror) HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 14e1c9b1fa56df83bb721805ca149fcc3a763d98 DIR parent 41cb87952c8f4bc9ddc983875a60080473040cae HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Mon, 3 Jan 2022 12:24:55 +0100 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! Diffstat: M stagit-gopher-index.c | 4 ++++ M stagit-gopher.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) --- DIR diff --git a/stagit-gopher-index.c b/stagit-gopher-index.c @@ -238,7 +238,11 @@ main(int argc, char *argv[]) setlocale(LC_CTYPE, ""); + /* do not search outside the git repository: + GIT_CONFIG_LEVEL_APP is the highest level currently */ git_libgit2_init(); + for (i = 1; i <= GIT_CONFIG_LEVEL_APP; i++) + git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, i, ""); #ifdef __OpenBSD__ if (pledge("stdio rpath", NULL) == -1) DIR diff --git a/stagit-gopher.c b/stagit-gopher.c @@ -1281,7 +1281,11 @@ main(int argc, char *argv[]) if (!realpath(repodir, repodirabs)) err(1, "realpath"); + /* do not search outside the git repository: + GIT_CONFIG_LEVEL_APP is the highest level currently */ git_libgit2_init(); + for (i = 1; i <= GIT_CONFIG_LEVEL_APP; i++) + git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, i, ""); #ifdef __OpenBSD__ if (unveil(repodir, "r") == -1)