]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/byte_extract: use list util in tests
authorVictor Julien <vjulien@oisf.net>
Fri, 17 Mar 2023 20:06:21 +0000 (21:06 +0100)
committerVictor Julien <vjulien@oisf.net>
Sat, 15 Apr 2023 05:02:49 +0000 (07:02 +0200)
src/detect-byte-extract.c

index 9c792ffaa3d0e73cca75aa300279aff86993d1fa..3f95eb39f47f00dbbf91e3cc19be4bc3d6af37fe 100644 (file)
@@ -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;