aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/eqn.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-10-25 15:06:30 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-10-25 15:06:30 +0000
commitbdc06e9bc94f24fb26627f37bbd9b2ea636f46dd (patch)
treee46d268f8a9230a976f2a850e32a3935d45bb114 /eqn.c
parent75b610f7273e99110015abd22311fcb909e0abd3 (diff)
downloadmandoc-bdc06e9bc94f24fb26627f37bbd9b2ea636f46dd.tar.gz
mandoc-bdc06e9bc94f24fb26627f37bbd9b2ea636f46dd.tar.zst
mandoc-bdc06e9bc94f24fb26627f37bbd9b2ea636f46dd.zip
Fix a NULL pointer dereference reported
by Theo Buehler <theo at math dot ethz dot ch> on tech at openbsd: Do not attempt to parse empty equations.
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/eqn.c b/eqn.c
index 31e674d0..a64031b2 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.55 2014/10/25 14:35:37 schwarze Exp $ */
+/* $Id: eqn.c,v 1.56 2014/10/25 15:06:30 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -684,7 +684,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);