goto end;
}
s = de_ctx->sig_list;
- if (s->sm_lists_tail[g_dce_stub_data_buffer_id] == NULL) {
- result = 0;
- goto end;
- }
- result &= (s->sm_lists_tail[g_dce_stub_data_buffer_id]->type == DETECT_BYTETEST);
- bd = (DetectBytetestData *)s->sm_lists_tail[g_dce_stub_data_buffer_id]->ctx;
+
+ SigMatch *sm = DetectBufferGetFirstSigMatch(s, g_dce_stub_data_buffer_id);
+ FAIL_IF_NULL(sm);
+ FAIL_IF_NULL(sm->next);
+ sm = sm->next;
+ FAIL_IF_NOT(sm->type == DETECT_BYTETEST);
+ bd = (DetectBytetestData *)sm->ctx;
if (!(bd->flags & DETECT_BYTETEST_DCE) &&
!(bd->flags & DETECT_BYTETEST_RELATIVE) &&
(bd->flags & DETECT_BYTETEST_STRING) &&
goto end;
}
s = s->next;
- if (s->sm_lists_tail[g_dce_stub_data_buffer_id] == NULL) {
- result = 0;
- goto end;
- }
- result &= (s->sm_lists_tail[g_dce_stub_data_buffer_id]->type == DETECT_BYTETEST);
- bd = (DetectBytetestData *)s->sm_lists_tail[g_dce_stub_data_buffer_id]->ctx;
+
+ sm = DetectBufferGetFirstSigMatch(s, g_dce_stub_data_buffer_id);
+ FAIL_IF_NULL(sm);
+ FAIL_IF_NULL(sm->next);
+ sm = sm->next;
+ bd = (DetectBytetestData *)sm->ctx;
if (!(bd->flags & DETECT_BYTETEST_DCE) &&
!(bd->flags & DETECT_BYTETEST_RELATIVE) &&
(bd->flags & DETECT_BYTETEST_STRING) &&
goto end;
}
s = s->next;
- if (s->sm_lists_tail[g_dce_stub_data_buffer_id] == NULL) {
- result = 0;
- goto end;
- }
- result &= (s->sm_lists_tail[g_dce_stub_data_buffer_id]->type == DETECT_BYTETEST);
- bd = (DetectBytetestData *)s->sm_lists_tail[g_dce_stub_data_buffer_id]->ctx;
+ sm = DetectBufferGetFirstSigMatch(s, g_dce_stub_data_buffer_id);
+ FAIL_IF_NULL(sm);
+ FAIL_IF_NULL(sm->next);
+ sm = sm->next;
+ bd = (DetectBytetestData *)sm->ctx;
if ((bd->flags & DETECT_BYTETEST_DCE) &&
!(bd->flags & DETECT_BYTETEST_RELATIVE) &&
(bd->flags & DETECT_BYTETEST_STRING) &&
}
s = de_ctx->sig_list;
- if (s->sm_lists_tail[g_file_data_buffer_id] == NULL) {
- printf("empty server body list: ");
- goto end;
- }
-
- if (s->sm_lists_tail[g_file_data_buffer_id]->type != DETECT_BYTETEST) {
- printf("bytetest not last sm in server body list: ");
- goto end;
- }
-
- bd = (DetectBytetestData *)s->sm_lists_tail[g_file_data_buffer_id]->ctx;
+ SigMatch *sm = DetectBufferGetFirstSigMatch(s, g_file_data_buffer_id);
+ FAIL_IF_NULL(sm);
+ FAIL_IF_NOT(sm->type == DETECT_BYTETEST);
+ bd = (DetectBytetestData *)sm->ctx;
if (bd->flags & DETECT_BYTETEST_DCE &&
bd->flags & DETECT_BYTETEST_RELATIVE &&
(bd->flags & DETECT_BYTETEST_STRING) &&