detect/mpm: don't test for impossible condition

Functions can't get called with NULL signature or NULL
Signature::init_data.
pull/10475/head
Victor Julien 3 years ago committed by Victor Julien
parent 962b505aa6
commit 124a8dea20

@ -772,18 +772,12 @@ int SignatureHasPacketContent(const Signature *s)
{ {
SCEnter(); SCEnter();
if (s == NULL) {
SCReturnInt(0);
}
if (!(s->proto.proto[IPPROTO_TCP / 8] & 1 << (IPPROTO_TCP % 8))) { if (!(s->proto.proto[IPPROTO_TCP / 8] & 1 << (IPPROTO_TCP % 8))) {
SCReturnInt(1); SCReturnInt(1);
} }
if ((s->init_data != NULL && s->init_data->smlists[DETECT_SM_LIST_PMATCH] == NULL) || if (s->init_data->smlists[DETECT_SM_LIST_PMATCH] == NULL) {
(s->init_data == NULL && s->sm_arrays[DETECT_SM_LIST_PMATCH] == NULL)) SCLogDebug("no PMATCH");
{
SCLogDebug("no mpm");
SCReturnInt(0); SCReturnInt(0);
} }
@ -808,18 +802,12 @@ int SignatureHasStreamContent(const Signature *s)
{ {
SCEnter(); SCEnter();
if (s == NULL) {
SCReturnInt(0);
}
if (!(s->proto.proto[IPPROTO_TCP / 8] & 1 << (IPPROTO_TCP % 8))) { if (!(s->proto.proto[IPPROTO_TCP / 8] & 1 << (IPPROTO_TCP % 8))) {
SCReturnInt(0); SCReturnInt(0);
} }
if ((s->init_data != NULL && s->init_data->smlists[DETECT_SM_LIST_PMATCH] == NULL) || if (s->init_data->smlists[DETECT_SM_LIST_PMATCH] == NULL) {
(s->init_data == NULL && s->sm_arrays[DETECT_SM_LIST_PMATCH] == NULL)) SCLogDebug("no PMATCH");
{
SCLogDebug("no mpm");
SCReturnInt(0); SCReturnInt(0);
} }

Loading…
Cancel
Save