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

oknet 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 25a0de4  Out-of-bounds while get port from host field
25a0de4 is described below

commit 25a0de406c9c2e48882bfe3153de53ae3d76fb35
Author: Oknet Xu <xuc...@skyguard.com.cn>
AuthorDate: Tue Aug 22 15:16:14 2017 +0800

    Out-of-bounds while get port from host field
---
 proxy/hdrs/HTTP.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index a6746a1..bcdd785 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -1544,6 +1544,7 @@ HTTPHdr::_fill_target_cache() const
 {
   URL *url = this->url_get();
   const char *port_ptr;
+  int port_len;
 
   m_target_in_url  = false;
   m_port_in_header = false;
@@ -1555,10 +1556,10 @@ HTTPHdr::_fill_target_cache() const
     m_port_in_header = 0 != url->port_get_raw();
     m_host_mime      = nullptr;
   } else if (nullptr !=
-             (m_host_mime = const_cast<HTTPHdr 
*>(this)->get_host_port_values(nullptr, &m_host_length, &port_ptr, nullptr))) {
+             (m_host_mime = const_cast<HTTPHdr 
*>(this)->get_host_port_values(nullptr, &m_host_length, &port_ptr, &port_len))) 
{
     m_port = 0;
     if (port_ptr) {
-      for (; is_digit(*port_ptr); ++port_ptr) {
+      for (; port_len > 0 && is_digit(*port_ptr); ++port_ptr, --port_len) {
         m_port = m_port * 10 + *port_ptr - '0';
       }
     }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Reply via email to