From cb1515965e22f6ee49d207ee6fbe66f94e9230ba Mon Sep 17 00:00:00 2001 From: schwarze Date: Fri, 30 Jan 2015 17:31:20 +0000 Subject: Delete the redundant tbl span flags, just inspect the actual data where needed, which is less fragile. This fixes a subtle NULL pointer access to tp->tbl.cols: Due to a bug in the man(7) parser, the first span of a table can end up in a .TP head, in which case tblcalc() was never called. Found by jsg@ with afl. --- usr.bin/mandoc/man_term.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.bin/mandoc/man_term.c') diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index b350643f8c1..a66ab89c2dc 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.119 2015/01/24 02:41:32 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.120 2015/01/30 17:31:20 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze @@ -947,7 +947,7 @@ print_man_node(DECL_ARGS) * Tables are preceded by a newline. Then process a * table line, which will cause line termination, */ - if (TBL_SPAN_FIRST & n->span->flags) + if (n->span->prev == NULL) term_newln(p); term_tbl(p, n->span); return; -- cgit v1.2.3-59-g8ed1b