detect/parse: error out on unused sticky buffers

pull/3580/head
Victor Julien 6 years ago
parent b36e921cf9
commit 3eec088d31

@ -627,7 +627,7 @@ static int DetectDnsQueryTest03(void)
s = DetectEngineAppendSig(de_ctx, "alert dns any any -> any any "
"(msg:\"Test dns_query option\"; "
"content:\"google\"; nocase; dns_query; sid:1;)");
"dns_query; content:\"google\"; nocase; sid:1;)");
FAIL_IF_NULL(s);
SigGroupBuild(de_ctx);

@ -1548,6 +1548,16 @@ static int SigValidate(DetectEngineCtx *de_ctx, Signature *s)
SCEnter();
/* check for sticky buffers that were set w/o matches
* e.g. alert ... (file_data; sid:1;) */
if (s->init_data->list != DETECT_SM_LIST_NOTSET) {
if (s->init_data->smlists[s->init_data->list] == NULL) {
SCLogError(SC_ERR_INVALID_SIGNATURE, "rule %u setup buffer %s but didn't add matches to it",
s->id, DetectBufferTypeGetNameById(de_ctx, s->init_data->list));
SCReturnInt(0);
}
}
/* run buffer type validation callbacks if any */
if (s->init_data->smlists[DETECT_SM_LIST_PMATCH]) {
if (DetectContentPMATCHValidateCallback(s) == FALSE)

Loading…
Cancel
Save