You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2019/04/30 15:56:32 UTC

[trafficserver] branch master updated: Off by 1 error in memcpy of redirect url

This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new d611b54  Off by 1 error in memcpy of redirect url
d611b54 is described below

commit d611b54aadd399641e009fde77017fed4d2da01f
Author: Susan Hinrichs <sh...@oath.com>
AuthorDate: Tue Apr 23 16:42:31 2019 +0000

    Off by 1 error in memcpy of redirect url
---
 proxy/http/HttpSM.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 533db3f..a01a120 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -7733,7 +7733,9 @@ HttpSM::redirect_request(const char *arg_redirect_url, const int arg_redirect_le
       // Prepend a slash and parse again.
       char redirect_url_leading_slash[arg_redirect_len + 1];
       redirect_url_leading_slash[0] = '/';
-      memcpy(redirect_url_leading_slash + 1, arg_redirect_url, arg_redirect_len + 1);
+      if (arg_redirect_len > 0) {
+        memcpy(redirect_url_leading_slash + 1, arg_redirect_url, arg_redirect_len);
+      }
       url_nuke_proxy_stuff(redirectUrl.m_url_impl);
       redirectUrl.parse(redirect_url_leading_slash, arg_redirect_len + 1);
     }