aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitc4641c1dc73700968ee90de85e04b2f32fbadc8a (patch)
tree22eb558acb2454bff882d8b4571d21d8c6fd8e54 /manpath.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 'manpath.c')
-rw-r--r--manpath.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/manpath.c b/manpath.c
index 01635cd8..61b2c7e0 100644
--- a/manpath.c
+++ b/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.14 2014/04/20 16:46:05 schwarze Exp $ */
+/* $Id: manpath.c,v 1.15 2014/04/23 21:06:41 schwarze Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -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);
}