From: Victor Julien Date: Fri, 17 Mar 2023 20:06:21 +0000 (+0100) Subject: detect/byte_extract: use list util in tests X-Git-Tag: suricata-7.0.0-rc2~388 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a718f19b0e122af31549224f3bf83d3feedd0bc9;p=thirdparty%2Fsuricata.git detect/byte_extract: use list util in tests --- 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;