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

bneradt 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 0be42cb124 Fixed logically dead code (#10611)
0be42cb124 is described below

commit 0be42cb124c468acfd0954a9dc3ebed80c8657b8
Author: Soumyajit Banik <123882475+soumyaji...@users.noreply.github.com>
AuthorDate: Tue Oct 17 04:06:42 2023 +0530

    Fixed logically dead code (#10611)
    
    CID 1508856: Logically dead code #10432
    
    In access_control.cc:
    
    ```cpp
    197    size_t equalsign = kvp.find(_tokenConfig.kvDelimiter);
            cond_cannot_single: Condition 18446744073709551615UL == equalsign, 
taking false branch. Now the value of equalsign cannot be equal to -1.
    198    if (kvp.npos == equalsign) {
    199      ERROR_OUT("invalid key-value-pair, missing key-value delimiter");
    200      return _state = INVALID_SYNTAX;
    201    }
    202    StringView key   = kvp.substr(0, equalsign);
            cannot_single: At condition equalsign != 18446744073709551615UL, 
the value of equalsign cannot be equal to -1.
            dead_error_condition: The condition equalsign != 
18446744073709551615UL must be true.
    
    CID 1508856 (#1 of 1): Logically dead code (DEADCODE)
    dead_error_line: Execution cannot reach this statement: 
<temporary>.basic_string_vi....
    203    StringView value = equalsign != kvp.npos ? kvp.substr(equalsign + 1) 
: "";
    ```
---
 plugins/experimental/access_control/access_control.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/experimental/access_control/access_control.cc 
b/plugins/experimental/access_control/access_control.cc
index 5ed93e0ca5..cdb0924b59 100644
--- a/plugins/experimental/access_control/access_control.cc
+++ b/plugins/experimental/access_control/access_control.cc
@@ -200,7 +200,7 @@ KvpAccessToken::parse(const StringView token)
       return _state = INVALID_SYNTAX;
     }
     StringView key   = kvp.substr(0, equalsign);
-    StringView value = equalsign != kvp.npos ? kvp.substr(equalsign + 1) : "";
+    StringView value = kvp.substr(equalsign + 1);
 
     DEBUG_OUT("kvp:'" << kvp << "', key:'" << key << "', value:'" << value << 
"'");
 

Reply via email to