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 2017/05/11 19:46:22 UTC
[trafficserver] branch master updated: Coverity issue 1200029,
1200026, 1200038
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 f28ba4e Coverity issue 1200029, 1200026, 1200038
f28ba4e is described below
commit f28ba4e472f66e48c274479d619cdd6116ac4e4a
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Thu May 11 15:16:22 2017 -0400
Coverity issue 1200029, 1200026, 1200038
---
plugins/healthchecks/healthchecks.c | 3 +-
plugins/regex_remap/regex_remap.cc | 86 +++++++++++++------------------------
2 files changed, 32 insertions(+), 57 deletions(-)
diff --git a/plugins/healthchecks/healthchecks.c b/plugins/healthchecks/healthchecks.c
index c58c344..995151e 100644
--- a/plugins/healthchecks/healthchecks.c
+++ b/plugins/healthchecks/healthchecks.c
@@ -189,9 +189,9 @@ hc_thread(void *data ATS_UNUSED)
while (1) {
HCFileData *fdata = fl_head, *fdata_prev = NULL;
+ gettimeofday(&now, NULL);
/* Read the inotify events, blocking until we get something */
len = read(fd, buffer, INOTIFY_BUFLEN);
- gettimeofday(&now, NULL);
/* The fl_head is a linked list of previously released data entries. They
are ordered "by time", so once we find one that is scheduled for deletion,
@@ -255,6 +255,7 @@ hc_thread(void *data ATS_UNUSED)
old_data->_next = fl_head;
fl_head = old_data;
}
+ /* coverity[ -tainted_data_return] */
i += sizeof(struct inotify_event) + event->len;
}
}
diff --git a/plugins/regex_remap/regex_remap.cc b/plugins/regex_remap/regex_remap.cc
index a6019e4..5829bea 100644
--- a/plugins/regex_remap/regex_remap.cc
+++ b/plugins/regex_remap/regex_remap.cc
@@ -124,22 +124,6 @@ struct UrlComponents {
class RemapRegex
{
public:
- RemapRegex()
- : _num_subs(-1),
- _rex(nullptr),
- _extra(nullptr),
- _options(0),
- _order(-1),
- _lowercase_substitutions(false),
- _active_timeout(-1),
- _no_activity_timeout(-1),
- _connect_timeout(-1),
- _dns_timeout(-1),
- _first_override(nullptr)
- {
- TSDebug(PLUGIN_NAME, "Calling constructor");
- }
-
~RemapRegex()
{
TSDebug(PLUGIN_NAME, "Calling destructor");
@@ -277,53 +261,45 @@ public:
}
private:
- char *_rex_string;
- char *_subst;
- int _subst_len;
- int _num_subs;
- int _hits;
-
- pcre *_rex;
- pcre_extra *_extra;
- int _options;
+ char *_rex_string = nullptr;
+ char *_subst = nullptr;
+ int _subst_len = 0;
+ int _num_subs = -1;
+ int _hits = 0;
+ int _options = 0;
+ int _order = -1;
+
+ bool _lowercase_substitutions = false;
+
+ pcre *_rex = nullptr;
+ pcre_extra *_extra = nullptr;
+ RemapRegex *_next = nullptr;
+ TSHttpStatus _status = static_cast<TSHttpStatus>(0);
+
+ int _active_timeout = -1;
+ int _no_activity_timeout = -1;
+ int _connect_timeout = -1;
+ int _dns_timeout = -1;
+
+ Override *_first_override = nullptr;
int _sub_pos[MAX_SUBS];
int _sub_ix[MAX_SUBS];
- RemapRegex *_next;
- int _order;
- TSHttpStatus _status;
- bool _lowercase_substitutions;
- int _active_timeout;
- int _no_activity_timeout;
- int _connect_timeout;
- int _dns_timeout;
-
- Override *_first_override;
};
bool
RemapRegex::initialize(const std::string ®, const std::string &sub, const std::string &opt)
{
- _status = static_cast<TSHttpStatus>(0);
-
if (!reg.empty()) {
_rex_string = TSstrdup(reg.c_str());
- } else {
- _rex_string = nullptr;
}
if (!sub.empty()) {
_subst = TSstrdup(sub.c_str());
_subst_len = sub.length();
- } else {
- _subst = nullptr;
- _subst_len = 0;
}
- _hits = 0;
-
memset(_sub_pos, 0, sizeof(_sub_pos));
memset(_sub_ix, 0, sizeof(_sub_ix));
- _next = nullptr;
// Parse options
std::string::size_type start = opt.find_first_of('@');
@@ -390,18 +366,16 @@ RemapRegex::initialize(const std::string ®, const std::string &sub, const std
delete cur;
return false;
}
- if (cur) {
- TSDebug(PLUGIN_NAME, "Overridable config %s=%s", opt_name.c_str(), opt_val.c_str());
- cur->key = key;
- cur->type = type;
- cur->next = nullptr;
- if (nullptr == last_override) {
- _first_override = cur;
- } else {
- last_override->next = cur;
- }
- last_override = cur;
+ TSDebug(PLUGIN_NAME, "Overridable config %s=%s", opt_name.c_str(), opt_val.c_str());
+ cur->key = key;
+ cur->type = type;
+ cur->next = nullptr;
+ if (nullptr == last_override) {
+ _first_override = cur;
+ } else {
+ last_override->next = cur;
}
+ last_override = cur;
} else {
TSError("[%s] Unknown options: %s", PLUGIN_NAME, opt.c_str());
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].