]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* mod_proxy_http2: ressurrecting some of the good parts of r1831231 and using memcpy...
authorStefan Eissing <icing@apache.org>
Tue, 5 Jun 2018 12:57:55 +0000 (12:57 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 5 Jun 2018 12:57:55 +0000 (12:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1832937 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_proxy_util.c

index 51feac4a06a75be6913a088f710364164c408658..bd45294e1aba59449638b7c0a9eb6e3bf7aecfcb 100644 (file)
@@ -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';            
         }