aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit9f10dd5f33cce148235192dbbd1b66d6b84a60aa (patch)
treec51a065ad0faf61837df706dca95fe3da52619ab /cgi.c
parentc4641c1dc73700968ee90de85e04b2f32fbadc8a (diff)
downloadmandoc-9f10dd5f33cce148235192dbbd1b66d6b84a60aa.tar.gz
mandoc-9f10dd5f33cce148235192dbbd1b66d6b84a60aa.tar.zst
mandoc-9f10dd5f33cce148235192dbbd1b66d6b84a60aa.zip
Audit malloc(3)/calloc(3)/realloc(3) usage.
First committed to wrong branch, sorry.
Diffstat (limited to 'cgi.c')
-rw-r--r--cgi.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/cgi.c b/cgi.c
index 35b20160..53fd21ca 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.50 2014/03/23 12:19:03 schwarze Exp $ */
+/* $Id: cgi.c,v 1.51 2014/04/23 21:40:47 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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.