This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 6f961fa9b5a82f3fb2a240ae3171407e5faf06f6 Author: Gancho Tenev <[email protected]> AuthorDate: Tue Jul 10 23:36:44 2018 -0700 ASAN: stack-use-after-scope in YamlLogConfig::decodeLogObject(YAML::Node const&) const char *mode_str = node["mode"].as<std::string>().c_str(); results in dangling mode_str pointer. (cherry picked from commit 7e5e6ede04fd74056636ab928ed9078aa19fe87a) --- proxy/logging/YamlLogConfig.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/logging/YamlLogConfig.cc b/proxy/logging/YamlLogConfig.cc index e6b9e8c..dc93f1c 100644 --- a/proxy/logging/YamlLogConfig.cc +++ b/proxy/logging/YamlLogConfig.cc @@ -139,10 +139,10 @@ YamlLogConfig::decodeLogObject(const YAML::Node &node) // file format LogFileFormat file_type = LOG_FILE_ASCII; // default value if (node["mode"]) { - const char *mode_str = node["mode"].as<std::string>().c_str(); - file_type = (strncasecmp(mode_str, "bin", 3) == 0 || (mode_str[0] == 'b' && mode_str[1] == 0) ? + std::string mode = node["mode"].as<std::string>(); + file_type = (0 == strncasecmp(mode.c_str(), "bin", 3) || (1 == mode.size() && mode[0] == 'b') ? LOG_FILE_BINARY : - (strcasecmp(mode_str, "ascii_pipe") == 0 ? LOG_FILE_PIPE : LOG_FILE_ASCII)); + (0 == strcasecmp(mode.c_str(), "ascii_pipe") ? LOG_FILE_PIPE : LOG_FILE_ASCII)); } int obj_rolling_enabled = 0;
