From: schwarze Date: Wed, 7 Feb 2018 20:31:32 +0000 (+0000) Subject: In man(7) and cat pages, cut off excessive one line descriptions. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=78b03aa7217ca2cc92242adca70d7c7de6bebed5;p=openbsd In man(7) and cat pages, cut off excessive one line descriptions. An extreme example of how rogue files could mess up apropos(1) output was reported by bentley@: qwtlicense(3) in the x11/qwt port. --- diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index 827ea2084d2..0e16fd39775 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandocdb.c,v 1.205 2017/08/26 20:38:09 schwarze Exp $ */ +/* $OpenBSD: mandocdb.c,v 1.206 2018/02/07 20:31:32 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011-2017 Ingo Schwarze @@ -1335,7 +1335,12 @@ parse_cat(struct mpage *mpage, int fd) plen -= 2; } - mpage->desc = mandoc_strdup(p); + /* + * Cut off excessive one-line descriptions. + * Bad pages are not worth better heuristics. + */ + + mpage->desc = mandoc_strndup(p, 150); fclose(stream); free(title); } @@ -1479,7 +1484,12 @@ parse_man(struct mpage *mpage, const struct roff_meta *meta, while (' ' == *start) start++; - mpage->desc = mandoc_strdup(start); + /* + * Cut off excessive one-line descriptions. + * Bad pages are not worth better heuristics. + */ + + mpage->desc = mandoc_strndup(start, 150); free(title); return; }