summaryrefslogtreecommitdiffstats
path: root/manpath.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
commitd14278c71c190ee93f3a8fbe0db5fe9f64fcee24 (patch)
treeb979660d5a5719053862183ee172a781e317d0ba /manpath.c
parentbd8fc166fb7a4aad04578dee7fe7fc209d5e1488 (diff)
downloadmandoc-d14278c71c190ee93f3a8fbe0db5fe9f64fcee24.tar.gz
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 'manpath.c')
-rw-r--r--manpath.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/manpath.c b/manpath.c
index 56fb73a0..c5d2cc0c 100644
--- a/manpath.c
+++ b/manpath.c
@@ -169,8 +169,8 @@ manpath_add(struct manpaths *dirs, const char *dir)
if (0 == strcmp(dirs->paths[i], dir))
return;
- dirs->paths = mandoc_realloc(dirs->paths,
- (dirs->sz + 1) * sizeof(char *));
+ dirs->paths = mandoc_reallocarray(dirs->paths,
+ dirs->sz + 1, sizeof(char *));
dirs->paths[dirs->sz++] = mandoc_strdup(cp);
}