class LenOption : public IpsOption
{
public:
- LenOption(const RangeCheck& c, bool r) : IpsOption(s_name), config(c), relative(r)
+ LenOption(const RangeCheck& c, bool r) : IpsOption(s_name), range(c), relative(r)
{ }
uint32_t hash() const override;
{ return CAT_READ; }
private:
- RangeCheck config;
+ RangeCheck range;
bool relative;
};
uint32_t LenOption::hash() const
{
- uint32_t a = config.hash();
+ uint32_t a = range.hash();
uint32_t b = IpsOption::hash();
- uint32_t c = 0;
+ uint32_t c = relative ? 1 : 0;
mix(a,b,c);
finalize(a,b,c);
return false;
const LenOption& rhs = (const LenOption&)ips;
- return ( config == rhs.config and relative == rhs.relative );
+ return ( range == rhs.range and relative == rhs.relative );
}
IpsOption::EvalStatus LenOption::eval(Cursor& c, Packet*)
RuleProfile profile(lenCheckPerfStats);
unsigned n = relative ? c.length() : c.size();
- if ( config.eval(n) )
+ if ( range.eval(n) )
return MATCH;
return NO_MATCH;
bool LenModule::begin(const char*, int, SnortConfig*)
{
data.init();
+ relative = false;
+
return true;
}
bool HashModule::begin(const char*, int, SnortConfig*)
{
- assert(!hmd);
+ delete hmd;
hmd = new HashMatchData;
return true;
}
bool HashModule::end(const char*, int, SnortConfig*)
{
if ( !hmd->length )
+ {
ParseError("%s requires length parameter", get_name());
+ return false;
+ }
return true;
}
bool forced_boundary = false;
int (* validate)(const uint8_t* buf, unsigned long long buflen) = nullptr;
- inline bool operator==(const SdPatternConfig& rhs) const
- {
- if ( pii == rhs.pii and threshold == rhs.threshold )
- return true;
- return false;
- }
+ bool operator==(const SdPatternConfig& rhs) const
+ { return pii == rhs.pii and threshold == rhs.threshold; }
SdPatternConfig()
{ reset(); }
can_be_obfuscated = false;
validate = nullptr;
db = nullptr;
+ pmd = { };
}
};
return false;
}
- config = SdPatternConfig();
+ config.reset();
return true;
}