You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2018/02/05 00:38:19 UTC

[trafficserver] 02/02: coverity 1385717: Out-of-bounds write

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

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit ddbfc64b54d8a70134e342d7d6c2ee56c07ad1fe
Author: Bryan Call <bc...@apache.org>
AuthorDate: Fri Feb 2 13:30:53 2018 -0800

    coverity 1385717: Out-of-bounds write
    
    (cherry picked from commit ee62ed7cbfbcf0c5734d0d2bfc4750d086f52968)
---
 proxy/http/HttpSM.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index a142125..62d374f 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -7068,7 +7068,7 @@ HttpSM::update_stats()
     int length                 = 0;
     const char *field          = t_state.hdr_info.client_request.value_get(MIME_FIELD_X_ID, MIME_LEN_X_ID, &length);
     if (field != nullptr && length > 0) {
-      length = std::min(length, static_cast<int>(sizeof(unique_id_string)));
+      length = std::min(length, static_cast<int>(sizeof(unique_id_string)) - 1);
       memcpy(unique_id_string, field, length);
       unique_id_string[length] = 0; // NULL terminate the string
     }

-- 
To stop receiving notification emails like this one, please contact
zwoop@apache.org.