]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/pcre: localize match limit option parsing
authorVictor Julien <vjulien@oisf.net>
Wed, 20 Dec 2023 08:42:53 +0000 (09:42 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Jan 2024 19:23:28 +0000 (20:23 +0100)
No need to put it into a per ctx flag.

src/detect-pcre.c
src/detect-pcre.h

index 848f6b9680fed512001c24d981b8925cf98d1369..0c22e8d8eafbc2af560ed4b04177bd31f7dfceeb 100644 (file)
@@ -360,6 +360,8 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
     int check_host_header = 0;
     char op_str[64] = "";
 
+    bool apply_match_limit = false;
+
     int cut_capture = 0;
     char *fcap = strstr(regexstr, "flow:");
     char *pcap = strstr(regexstr, "pkt:");
@@ -472,7 +474,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
                     break;
 
                 case 'O':
-                    pd->flags |= DETECT_PCRE_MATCH_LIMIT;
+                    apply_match_limit = true;
                     break;
 
                 case 'B': /* snort's option */
@@ -678,7 +680,7 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx,
     }
     pd->parse_regex.match = pcre2_match_data_create_from_pattern(pd->parse_regex.regex, NULL);
 
-    if (pd->flags & DETECT_PCRE_MATCH_LIMIT) {
+    if (apply_match_limit) {
         if (pcre_match_limit >= -1) {
             pcre2_set_match_limit(pd->parse_regex.context, pcre_match_limit);
         }
index 2d78dd0047fcc3a1eab11158c7dfb3cda677d263..9ac14ab90aa4998d60385c462829d372da81736a 100644 (file)
@@ -31,7 +31,6 @@
 #define DETECT_PCRE_RAWBYTES            0x00002
 #define DETECT_PCRE_CASELESS            0x00004
 
-#define DETECT_PCRE_MATCH_LIMIT         0x00020
 #define DETECT_PCRE_RELATIVE_NEXT       0x00040
 #define DETECT_PCRE_NEGATE              0x00080