summaryrefslogtreecommitdiffstats
path: root/tbl_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-07-31 16:14:10 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-07-31 16:14:10 +0000
commitd41a68de8e563ec665662c6908538a9ca789db39 (patch)
treeb4d96734cda76f0ae5ca915fadff793eb53152bf /tbl_term.c
parent8f670667f66c9cd558e335e8987b7e8d1faad4c4 (diff)
downloadmandoc-d41a68de8e563ec665662c6908538a9ca789db39.tar.gz
Ignore explicitly specified negative column widths rather than
wrapping around to huge numbers and risking memory exhaustion; fixes Debian ps(1). Bug reported by Dr. Markus Waldeck.
Diffstat (limited to 'tbl_term.c')
-rw-r--r--tbl_term.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tbl_term.c b/tbl_term.c
index 1d4b0389..ca63bd8d 100644
--- a/tbl_term.c
+++ b/tbl_term.c
@@ -51,7 +51,10 @@ static void tbl_word(struct termp *, const struct tbl_dat *);
static size_t
term_tbl_sulen(const struct roffsu *su, void *arg)
{
- return term_hen((const struct termp *)arg, su);
+ int i;
+
+ i = term_hen((const struct termp *)arg, su);
+ return i > 0 ? i : 0;
}
static size_t