aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/eqn.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-23 21:06:41 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-23 21:06:41 +0000
commitc4641c1dc73700968ee90de85e04b2f32fbadc8a (patch)
tree22eb558acb2454bff882d8b4571d21d8c6fd8e54 /eqn.c
parent2255a3e49af03406199043bf555c96acf31eb877 (diff)
downloadmandoc-c4641c1dc73700968ee90de85e04b2f32fbadc8a.tar.gz
mandoc-c4641c1dc73700968ee90de85e04b2f32fbadc8a.tar.zst
mandoc-c4641c1dc73700968ee90de85e04b2f32fbadc8a.zip
Audit malloc(3)/calloc(3)/realloc(3) usage.
* Change eight reallocs to reallocarray to be safe from overflows. * Change one malloc to reallocarray to be safe from overflows. * Change one calloc to reallocarray, no zeroing needed. * Change the order of arguments of three callocs (aesthetical).
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/eqn.c b/eqn.c
index 12b00e51..57cbfca1 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.41 2014/04/20 19:40:13 schwarze Exp $ */
+/* $Id: eqn.c,v 1.42 2014/04/23 21:06:41 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -864,8 +864,8 @@ eqn_do_define(struct eqn_node *ep)
if (i == (int)ep->defsz) {
ep->defsz++;
- ep->defs = mandoc_realloc(ep->defs,
- ep->defsz * sizeof(struct eqn_def));
+ ep->defs = mandoc_reallocarray(ep->defs,
+ ep->defsz, sizeof(struct eqn_def));
ep->defs[i].key = ep->defs[i].val = NULL;
}