]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
apr_pcalloc can be turned into apr_palloc (the allocated memory is fully initialized...
authorChristophe Jaillet <jailletc36@apache.org>
Tue, 12 Jun 2018 17:13:27 +0000 (17:13 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Tue, 12 Jun 2018 17:13:27 +0000 (17:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1833415 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_proxy_util.c

index bd45294e1aba59449638b7c0a9eb6e3bf7aecfcb..3cbf4d0b4b57db1a4b1525dee8a3d1144e04c3e3 100644 (file)
@@ -915,12 +915,12 @@ static size_t subst_str(link_ctx *ctx, int start, int end, const char *ns)
     nlen = (int)strlen(ns);
     delta = nlen - olen;
     plen = ctx->slen + delta + 1;
-    p = apr_pcalloc(ctx->pool, plen);
+    p = apr_palloc(ctx->pool, plen);
     memcpy(p, ctx->s, start);
     memcpy(p + start, ns, nlen);
     strcpy(p + start + nlen, ctx->s + end);
     ctx->s = p;
-    ctx->slen = (int)strlen(p);
+    ctx->slen = plen - 1;   /* (int)strlen(p) */
     if (ctx->i >= end) {
         ctx->i += delta;
     }