summaryrefslogtreecommitdiffstats
path: root/cgi.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-23 21:40:47 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-23 21:40:47 +0000
commit7cb3a7b37aab73a5a42c6db182082d4fa806c542 (patch)
tree9a8a8c9de8012510939647e634ebf86ceb49d781 /cgi.c
parentd14278c71c190ee93f3a8fbe0db5fe9f64fcee24 (diff)
downloadmandoc-7cb3a7b37aab73a5a42c6db182082d4fa806c542.tar.gz
Audit malloc(3)/calloc(3)/realloc(3) usage.
First committed to wrong branch, sorry.
Diffstat (limited to 'cgi.c')
-rw-r--r--cgi.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/cgi.c b/cgi.c
index 27d78459..b8c3f078 100644
--- a/cgi.c
+++ b/cgi.c
@@ -936,7 +936,7 @@ pg_search(const struct req *req, char *path)
ep++;
while (ep && '\0' != *ep) {
- cp = mandoc_realloc(cp, (sz + 1) * sizeof(char *));
+ cp = mandoc_reallocarray(cp, sz + 1, sizeof(char *));
start = ep;
while ('\0' != *ep && ! isspace((unsigned char)*ep))
ep++;
@@ -1180,9 +1180,8 @@ pathgen(DIR *dir, char *path, struct req *req)
if (rc > 0) {
/* This also strips the trailing slash. */
path[(int)--sz] = '\0';
- req->p = mandoc_realloc
- (req->p,
- (req->psz + 1) * sizeof(struct paths));
+ req->p = mandoc_reallocarray(req->p,
+ req->psz + 1, sizeof(struct paths));
/*
* Strip out the leading "./" unless we're just a ".",
* in which case use an empty string as our name.