From: Stefan Eissing Date: Tue, 5 Jun 2018 12:57:55 +0000 (+0000) Subject: * mod_proxy_http2: ressurrecting some of the good parts of r1831231 and using memcpy... X-Git-Tag: 2.5.0-alpha2-ci-test-only~2570 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ab2b14cfcb54a4406edd633e9a32b17acc32dc2;p=thirdparty%2Fapache%2Fhttpd.git * mod_proxy_http2: ressurrecting some of the good parts of r1831231 and using memcpy instead of strncpy to make intentions more clear git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1832937 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_proxy_util.c b/modules/http2/h2_proxy_util.c index 51feac4a06a..bd45294e1ab 100644 --- a/modules/http2/h2_proxy_util.c +++ b/modules/http2/h2_proxy_util.c @@ -951,9 +951,7 @@ static void map_link(link_ctx *ctx) "link_reverse_map uri too long, skipped: %s", ctx->s); return; } - strncpy(buffer + buffer_len, ctx->s + ctx->link_start, link_len); - buffer_len += link_len; - buffer[buffer_len] = '\0'; + apr_cpystrn(buffer + buffer_len, ctx->s + ctx->link_start, link_len + 1); if (!prepend_p_server && strcmp(ctx->real_backend_uri, ctx->p_server_uri) && !strncmp(buffer, ctx->real_backend_uri, ctx->rbu_len)) { @@ -961,8 +959,8 @@ static void map_link(link_ctx *ctx) * to work, we need to use the proxy uri */ int path_start = ctx->link_start + ctx->rbu_len; link_len -= ctx->rbu_len; - strcpy(buffer, ctx->p_server_uri); - strncpy(buffer + ctx->psu_len, ctx->s + path_start, link_len); + memcpy(buffer, ctx->p_server_uri, ctx->psu_len); + memcpy(buffer + ctx->psu_len, ctx->s + path_start, link_len); buffer_len = ctx->psu_len + link_len; buffer[buffer_len] = '\0'; }