diff options
author | 2014-10-25 15:06:30 +0000 | |
---|---|---|
committer | 2014-10-25 15:06:30 +0000 | |
commit | bdc06e9bc94f24fb26627f37bbd9b2ea636f46dd (patch) | |
tree | e46d268f8a9230a976f2a850e32a3935d45bb114 /eqn.c | |
parent | 75b610f7273e99110015abd22311fcb909e0abd3 (diff) | |
download | mandoc-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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); |