You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ls...@apache.org on 2023/09/26 16:15:00 UTC
[trafficserver] branch master updated: Coverity 1518592: check cachekey valid (#10491)
This is an automated email from the ASF dual-hosted git repository.
lserris 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 38a247671f Coverity 1518592: check cachekey valid (#10491)
38a247671f is described below
commit 38a247671fdfb1d6758ceb143386cbb70e2238e6
Author: Serris Lew <se...@gmail.com>
AuthorDate: Tue Sep 26 09:14:53 2023 -0700
Coverity 1518592: check cachekey valid (#10491)
Co-authored-by: Serris Lew <ls...@apple.com>
---
plugins/cachekey/cachekey.h | 6 ++++++
plugins/cachekey/plugin.cc | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/plugins/cachekey/cachekey.h b/plugins/cachekey/cachekey.h
index 1f7331ad70..b191999d48 100644
--- a/plugins/cachekey/cachekey.h
+++ b/plugins/cachekey/cachekey.h
@@ -68,6 +68,12 @@ public:
bool appendUaClass(Classifier &classifier);
bool finalize() const;
+ bool
+ isValid()
+ {
+ return _valid;
+ }
+
// noncopyable
CacheKey(const CacheKey &) = delete; // disallow
CacheKey &operator=(const CacheKey &) = delete; // disallow
diff --git a/plugins/cachekey/plugin.cc b/plugins/cachekey/plugin.cc
index d92c079271..3f22fedf66 100644
--- a/plugins/cachekey/plugin.cc
+++ b/plugins/cachekey/plugin.cc
@@ -44,6 +44,11 @@ setCacheKey(TSHttpTxn txn, Configs *config, TSRemapRequestInfo *rri = nullptr)
/* Initial cache key facility from the requested URL. */
CacheKey cachekey(txn, config->getSeparator(), config->getUriType(), type, rri);
+ /* Don't use cachekey if not initialized properly */
+ if (!cachekey.isValid()) {
+ continue;
+ }
+
/* Append custom prefix or the host:port */
if (!config->prefixToBeRemoved()) {
cachekey.appendPrefix(config->_prefix, config->_prefixCapture, config->_prefixCaptureUri, config->canonicalPrefix());