diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-10-25 15:05:22 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-10-25 15:05:22 +0000 |
commit | df166831bc77a84a51559826ab049cc215ee1669 (patch) | |
tree | 3ebfcfe9beeffaed3a9f181c64f66d72405fd1c3 /usr.bin | |
parent | 23640dfdc3b34b2fe692227e2ffe687359cae60e (diff) |
Fix a NULL pointer dereference reported
by Theo Buehler <theo at math dot ethz dot ch> on tech@:
Do not attempt to parse empty equations.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/eqn.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/mandoc/eqn.c b/usr.bin/mandoc/eqn.c index 82d169ed6b1..3ab209c555a 100644 --- a/usr.bin/mandoc/eqn.c +++ b/usr.bin/mandoc/eqn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eqn.c,v 1.18 2014/10/25 14:32:07 schwarze Exp $ */ +/* $OpenBSD: eqn.c,v 1.19 2014/10/25 15:05:21 schwarze Exp $ */ /* * Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -682,7 +682,9 @@ eqn_parse(struct eqn_node *ep, struct eqn_box *parent) char sym[64]; const char *start; - assert(NULL != parent); + assert(parent != NULL); + if (ep->data == NULL) + return(-1); next_tok: tok = eqn_tok_parse(ep, &p); |