summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2021-08-19 16:55:25 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2021-08-19 16:55:25 +0000
commitb3ddf555251083271a40f1aea251029920bceeb5 (patch)
treef63eac41f556e0b3966f554e574960b3029e3162
parent07fa5126daeb16a68da68315aa19260e110b29d5 (diff)
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--usr.bin/mandoc/mandocdb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index 6e7efaec255..9699fdeac7e 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandocdb.c,v 1.216 2020/04/03 11:34:19 schwarze Exp $ */
+/* $OpenBSD: mandocdb.c,v 1.217 2021/08/19 16:55:24 schwarze Exp $ */
/*
* Copyright (c) 2011-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -592,6 +592,8 @@ treescan(void)
say(path, "&stat");
continue;
}
+ if ((ff->fts_statp->st_mode & S_IFMT) != S_IFREG)
+ continue;
/* FALLTHROUGH */
/*