summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-03-18 08:00:34 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-03-18 08:00:34 +0000
commit034fc65e0973095b716d53e0292987e393d4bfa3 (patch)
tree7e8fbcd2f9168416e1efd22dda32934be7d6c77e
parent1c486423eae0c24d583bb28910ba9da5fef3df32 (diff)
downloadmandoc-034fc65e0973095b716d53e0292987e393d4bfa3.tar.gz
fix a NULL pointer access on empty tbl(7) data cells
that bentley@ found in syncthing-bep(7)
-rw-r--r--tbl_term.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tbl_term.c b/tbl_term.c
index f9a88091..50c9d537 100644
--- a/tbl_term.c
+++ b/tbl_term.c
@@ -629,7 +629,8 @@ tbl_hrule(struct termp *tp, const struct tbl_span *spp,
lw = cpp == NULL || cpn == NULL ||
(cpn->pos != TBL_CELL_DOWN &&
- (dpn == NULL || strcmp(dpn->string, "\\^") != 0))
+ (dpn == NULL || dpn->string == NULL ||
+ strcmp(dpn->string, "\\^") != 0))
? hw : 0;
tbl_direct_border(tp, BHORIZ * lw,
col->width + col->spacing / 2);
@@ -675,7 +676,8 @@ tbl_hrule(struct termp *tp, const struct tbl_span *spp,
rw = cpp == NULL || cpn == NULL ||
(cpn->pos != TBL_CELL_DOWN &&
- (dpn == NULL || strcmp(dpn->string, "\\^") != 0))
+ (dpn == NULL || dpn->string == NULL ||
+ strcmp(dpn->string, "\\^") != 0))
? hw : 0;
/* The line crossing at the end of this column. */