diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-04-23 21:40:47 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-04-23 21:40:47 +0000 |
commit | 7cb3a7b37aab73a5a42c6db182082d4fa806c542 (patch) | |
tree | 9a8a8c9de8012510939647e634ebf86ceb49d781 /cgi.c | |
parent | d14278c71c190ee93f3a8fbe0db5fe9f64fcee24 (diff) | |
download | mandoc-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.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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. |