|
|
libgit2 config opts: set the search to an empty path - stagit-gopher - static git page generator for gopher |
|
|
 |
git clone git://git.codemadness.org/stagit-gopher (git://git.codemadness.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
README |
|
|
 |
LICENSE |
|
|
|
--- |
|
|
 |
commit 14e1c9b1fa56df83bb721805ca149fcc3a763d98 |
|
|
 |
parent 41cb87952c8f4bc9ddc983875a60080473040cae |
|
|
 |
Author: Hiltjo Posthuma <hiltjo@codemadness.org> (mailto://) |
application/vnd.lotus-organizer |
|
|
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(-) |
|
|
|
--- |
|
|
 |
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) |
|