aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2021-08-19 16:55:31 +0000
committerIngo Schwarze <schwarze@openbsd.org>2021-08-19 16:55:31 +0000
commitfe0b0092185401581ba11b44f08520bad87fbeda (patch)
tree1096f1a2efcb13f92c8d2815670c1881f8d35784
parentcbbdb9798fbefe0870d5857631fb51afe0697da2 (diff)
downloadmandoc-fe0b0092185401581ba11b44f08520bad87fbeda.tar.gz
mandoc-fe0b0092185401581ba11b44f08520bad87fbeda.tar.zst
mandoc-fe0b0092185401581ba11b44f08520bad87fbeda.zip
do not crash when a manpath directory contains a symbolic link
that points to a directory rather than to a regular file; bug reported by Lukas Epple <sternenseemann at systemli dot org>, and my patch also tested by him on NixOS
-rw-r--r--mandocdb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 0ef661b2..a3360fe4 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.268 2021/08/07 13:02:10 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.269 2021/08/19 16:55:31 schwarze Exp $ */
/*
* Copyright (c) 2011-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -629,6 +629,8 @@ treescan(void)
say(path, "&stat");
continue;
}
+ if ((ff->fts_statp->st_mode & S_IFMT) != S_IFREG)
+ continue;
/* FALLTHROUGH */
/*