From f4d6373f1c2ad3ab24fd2d42d10cd994fb9e9e03 Mon Sep 17 00:00:00 2001 From: schwarze Date: Thu, 19 Aug 2021 16:55:24 +0000 Subject: [PATCH] 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 , and my patch also tested by him on NixOS --- usr.bin/mandoc/mandocdb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 * Copyright (c) 2011, 2012 Kristaps Dzonsons @@ -592,6 +592,8 @@ treescan(void) say(path, "&stat"); continue; } + if ((ff->fts_statp->st_mode & S_IFMT) != S_IFREG) + continue; /* FALLTHROUGH */ /* -- 2.20.1