diff --git a/headers/modsecurity/actions/action.h b/headers/modsecurity/actions/action.h index 66283993..4dd693a6 100644 --- a/headers/modsecurity/actions/action.h +++ b/headers/modsecurity/actions/action.h @@ -17,6 +17,8 @@ #include +#include + #endif @@ -35,7 +37,9 @@ class Action { Action() : m_parserPayload(""), m_name("") - { } + { + assert(0); + } explicit Action(const std::string& action) @@ -44,9 +48,9 @@ class Action { { } - Action(const Action &a) - : m_parserPayload(a.m_parserPayload), - m_name(a.m_name) + Action(const Action &other) + : m_parserPayload(other.m_parserPayload), + m_name(other.m_name) { } @@ -76,7 +80,7 @@ class Action { } - const std::string *getName() const { + const std::string *getName() const noexcept { return &m_name; } diff --git a/src/actions/transformations/transformation.cc b/src/actions/transformations/transformation.cc index c275b1b9..3870c6c4 100644 --- a/src/actions/transformations/transformation.cc +++ b/src/actions/transformations/transformation.cc @@ -65,17 +65,23 @@ namespace actions { namespace transformations { -class TransformationDoesNotExist: public std::exception { +class TransformationDoesNotExist : public std::exception { public: + explicit TransformationDoesNotExist(const char *name) + : m_transformation(name) + { } + explicit TransformationDoesNotExist(const std::string& name) : m_transformation(name) { } - virtual const char* what() const throw() { - return std::string("Transformation not found: " + m_transformation + \ - ". Make sure that the new transformation is registered at: " + \ - "transformation.cc").c_str(); - } + virtual ~TransformationDoesNotExist() throw (){} + + virtual const char* what() const throw() { + return strdup(std::string("Transformation not found: " + m_transformation + \ + ". Make sure that the new transformation is registered at: " + \ + "transformation.cc").c_str()); + } private: std::string m_transformation; diff --git a/src/actions/transformations/trim_left.h b/src/actions/transformations/trim_left.h index d9d7cef3..ba731f60 100644 --- a/src/actions/transformations/trim_left.h +++ b/src/actions/transformations/trim_left.h @@ -34,7 +34,7 @@ namespace transformations { class TrimLeft : public Trim { public: TrimLeft() - : Trim("t:trimLeft") + : Action("t:trimLeft") { } void execute(const Transaction *t, diff --git a/src/actions/transformations/trim_right.h b/src/actions/transformations/trim_right.h index 9241e241..3799e6bc 100644 --- a/src/actions/transformations/trim_right.h +++ b/src/actions/transformations/trim_right.h @@ -34,7 +34,7 @@ namespace transformations { class TrimRight : public Trim { public: TrimRight() - : Trim("t:trimRight") + : Action("t:trimRight") { } void execute(const Transaction *t,