From a718f19b0e122af31549224f3bf83d3feedd0bc9 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 17 Mar 2023 21:06:21 +0100 Subject: [PATCH] detect/byte_extract: use list util in tests --- src/detect-byte-extract.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/detect-byte-extract.c b/src/detect-byte-extract.c index 9c792ffaa3..3f95eb39f4 100644 --- a/src/detect-byte-extract.c +++ b/src/detect-byte-extract.c @@ -1707,7 +1707,7 @@ static int DetectByteExtractTest37(void) goto end; } - sm = s->sm_lists[g_http_uri_buffer_id]; + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -1820,7 +1820,7 @@ static int DetectByteExtractTest38(void) goto end; } - sm = s->sm_lists[g_http_uri_buffer_id]; + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -1908,7 +1908,7 @@ static int DetectByteExtractTest39(void) goto end; } - sm = s->sm_lists[g_http_uri_buffer_id]; + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -2021,7 +2021,7 @@ static int DetectByteExtractTest40(void) goto end; } - sm = s->sm_lists[g_http_uri_buffer_id]; + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -2253,7 +2253,7 @@ static int DetectByteExtractTest42(void) if (sm->next != NULL) goto end; - sm = s->sm_lists[g_http_uri_buffer_id]; + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -3792,7 +3792,7 @@ static int DetectByteExtractTest56(void) goto end; } - sm = s->sm_lists[g_http_uri_buffer_id]; + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -3964,7 +3964,7 @@ static int DetectByteExtractTest57(void) if (sm->next != NULL) goto end; - sm = s->sm_lists[g_http_uri_buffer_id]; + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -4427,12 +4427,11 @@ static int DetectByteExtractTest60(void) if (sm->next != NULL) goto end; - if (s->sm_lists_tail[g_http_uri_buffer_id] == NULL) { + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); + if (sm == NULL) { result = 0; goto end; } - - sm = s->sm_lists[g_http_uri_buffer_id]; if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -4557,12 +4556,11 @@ static int DetectByteExtractTest61(void) if (sm->next != NULL) goto end; - if (s->sm_lists_tail[g_http_uri_buffer_id] == NULL) { + sm = DetectBufferGetFirstSigMatch(s, g_http_uri_buffer_id); + if (sm == NULL) { result = 0; goto end; } - - sm = s->sm_lists[g_http_uri_buffer_id]; if (sm->type != DETECT_CONTENT) { result = 0; goto end; @@ -4644,13 +4642,11 @@ static int DetectByteExtractTest62(void) goto end; } - if (s->sm_lists_tail[g_file_data_buffer_id] == NULL) { + sm = DetectBufferGetFirstSigMatch(s, g_file_data_buffer_id); + if (sm == NULL) { goto end; } - - sm = s->sm_lists[g_file_data_buffer_id]; if (sm->type != DETECT_BYTE_EXTRACT) { - result = 0; goto end; } bed = (DetectByteExtractData *)sm->ctx;