aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-02-07 20:31:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-02-07 20:31:39 +0000
commit1bc6ab722f082440bad4dc064025f98486495299 (patch)
treec1909190a7351812028c7112b97e71882659e2a6 /mandocdb.c
parenta01d965c76db9cf227d69d8316586f39cd940ab1 (diff)
downloadmandoc-1bc6ab722f082440bad4dc064025f98486495299.tar.gz
mandoc-1bc6ab722f082440bad4dc064025f98486495299.tar.zst
mandoc-1bc6ab722f082440bad4dc064025f98486495299.zip
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.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 54675c69..0872555a 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.256 2017/08/26 20:38:14 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.257 2018/02/07 20:31:39 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -1373,7 +1373,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);
}
@@ -1517,7 +1522,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;
}