stagit-gopher

[fork] gopher git frontend
Log | Files | Refs | README | LICENSE

commit 14e1c9b1fa56df83bb721805ca149fcc3a763d98
parent 41cb87952c8f4bc9ddc983875a60080473040cae
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:
Mstagit-gopher-index.c | 4++++
Mstagit-gopher.c | 4++++
2 files changed, 8 insertions(+), 0 deletions(-)

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) 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)