mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Action: make sure that null constructor is not used
This commit is contained in:
parent
c7813a1973
commit
a79bfa5c28
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +37,9 @@ class Action {
|
|||||||
Action()
|
Action()
|
||||||
: m_parserPayload(""),
|
: m_parserPayload(""),
|
||||||
m_name("")
|
m_name("")
|
||||||
{ }
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
explicit Action(const std::string& action)
|
explicit Action(const std::string& action)
|
||||||
@ -44,9 +48,9 @@ class Action {
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
Action(const Action &a)
|
Action(const Action &other)
|
||||||
: m_parserPayload(a.m_parserPayload),
|
: m_parserPayload(other.m_parserPayload),
|
||||||
m_name(a.m_name)
|
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;
|
return &m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,16 +65,22 @@ namespace actions {
|
|||||||
namespace transformations {
|
namespace transformations {
|
||||||
|
|
||||||
|
|
||||||
class TransformationDoesNotExist: public std::exception {
|
class TransformationDoesNotExist : public std::exception {
|
||||||
public:
|
public:
|
||||||
|
explicit TransformationDoesNotExist(const char *name)
|
||||||
|
: m_transformation(name)
|
||||||
|
{ }
|
||||||
|
|
||||||
explicit TransformationDoesNotExist(const std::string& name)
|
explicit TransformationDoesNotExist(const std::string& name)
|
||||||
: m_transformation(name)
|
: m_transformation(name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
virtual ~TransformationDoesNotExist() throw (){}
|
||||||
|
|
||||||
virtual const char* what() const throw() {
|
virtual const char* what() const throw() {
|
||||||
return std::string("Transformation not found: " + m_transformation + \
|
return strdup(std::string("Transformation not found: " + m_transformation + \
|
||||||
". Make sure that the new transformation is registered at: " + \
|
". Make sure that the new transformation is registered at: " + \
|
||||||
"transformation.cc").c_str();
|
"transformation.cc").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -34,7 +34,7 @@ namespace transformations {
|
|||||||
class TrimLeft : public Trim {
|
class TrimLeft : public Trim {
|
||||||
public:
|
public:
|
||||||
TrimLeft()
|
TrimLeft()
|
||||||
: Trim("t:trimLeft")
|
: Action("t:trimLeft")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void execute(const Transaction *t,
|
void execute(const Transaction *t,
|
||||||
|
@ -34,7 +34,7 @@ namespace transformations {
|
|||||||
class TrimRight : public Trim {
|
class TrimRight : public Trim {
|
||||||
public:
|
public:
|
||||||
TrimRight()
|
TrimRight()
|
||||||
: Trim("t:trimRight")
|
: Action("t:trimRight")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void execute(const Transaction *t,
|
void execute(const Transaction *t,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user