trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] branch master updated: clang: Logic error
Date Tue, 08 May 2018 11:24:46 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop 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 d1b22a4  clang: Logic error
d1b22a4 is described below

commit d1b22a42ae1f28245a004d6795cb38d35372cb78
Author: Gancho Tenev <gancho@apache.org>
AuthorDate: Mon May 7 16:40:14 2018 +0100

    clang: Logic error
    
    Bug Type: Result of operation is garbage or undefined
    File: proxy/http/HttpTransact.cc
    Function/Method: issue_revalidate
---
 proxy/http/HttpTransact.cc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index eae6f70..2e04aa3 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -2268,13 +2268,15 @@ HttpTransact::issue_revalidate(State *s)
     // if Etag exists, also add if-non-match header
     if (c_resp->presence(MIME_PRESENCE_ETAG) && (s->hdr_info.server_request.method_get_wksidx()
== HTTP_WKSIDX_GET ||
                                                  s->hdr_info.server_request.method_get_wksidx()
== HTTP_WKSIDX_HEAD)) {
-      int length;
+      int length       = 0;
       const char *etag = c_resp->value_get(MIME_FIELD_ETAG, MIME_LEN_ETAG, &length);
-      if ((length >= 2) && (etag[0] == 'W') && (etag[1] == '/')) {
-        etag += 2;
-        length -= 2;
+      if (nullptr != etag) {
+        if ((length >= 2) && (etag[0] == 'W') && (etag[1] == '/')) {
+          etag += 2;
+          length -= 2;
+        }
+        s->hdr_info.server_request.value_set(MIME_FIELD_IF_NONE_MATCH, MIME_LEN_IF_NONE_MATCH,
etag, length);
       }
-      s->hdr_info.server_request.value_set(MIME_FIELD_IF_NONE_MATCH, MIME_LEN_IF_NONE_MATCH,
etag, length);
       if (!s->cop_test_page)
         DUMP_HEADER("http_hdrs", &s->hdr_info.server_request, s->state_machine_id,
"Proxy's Request (Conditionalized)");
     }

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

Mime
View raw message