]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pcre2: follow code naming style
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 20 Sep 2021 20:02:50 +0000 (22:02 +0200)
committerPhilippe Antoine <contact@catenacyber.fr>
Tue, 28 Sep 2021 15:46:19 +0000 (17:46 +0200)
21 files changed:
src/detect-byte-extract.c
src/detect-bytemath.c
src/detect-dsize.c
src/detect-filesize.c
src/detect-flow.c
src/detect-fragbits.c
src/detect-fragoffset.c
src/detect-icmp-id.c
src/detect-icmp-seq.c
src/detect-icode.c
src/detect-itype.c
src/detect-nfs-procedure.c
src/detect-nfs-version.c
src/detect-parse.c
src/detect-parse.h
src/detect-rfb-sectype.c
src/detect-snmp-version.c
src/detect-tcp-flags.c
src/detect-tcp-window.c
src/detect-tls-cert-validity.c
src/detect-urilen.c

index 49f2c4bae8aa3790569d2aa8262920d31b4e4aa7..7c1ba2182a4fe4c42916ade747b5065e705cdc56 100644 (file)
@@ -284,7 +284,7 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_
     for (i = 4; i < ret; i++) {
         char opt_str[64] = "";
         pcre2len = sizeof(opt_str);
-        res = SC_pcre2_substring_copy(parse_regex.match, i, (PCRE2_UCHAR8 *)opt_str, &pcre2len);
+        res = SC_Pcre2SubstringCopy(parse_regex.match, i, (PCRE2_UCHAR8 *)opt_str, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING,
                     "pcre2_substring_copy_bynumber failed "
index 7a46f5ebd0cb914809de392c5952c5f57e8b7a09..316a4e0413cce855290f7f9bc733388cb9b356fe 100644 (file)
@@ -399,7 +399,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch
 
     if (ret > RELATIVE_KW) {
         pcre2len = sizeof(tmp_str);
-        res = SC_pcre2_substring_copy(
+        res = SC_Pcre2SubstringCopy(
                 parse_regex.match, RELATIVE_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len);
 
         if (res < 0) {
@@ -415,7 +415,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch
 
     if (ret > ENDIAN_VAL) {
         pcre2len = sizeof(tmp_str);
-        res = SC_pcre2_substring_copy(
+        res = SC_Pcre2SubstringCopy(
                 parse_regex.match, ENDIAN_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
@@ -428,7 +428,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch
         }
 
         pcre2len = sizeof(tmp_str);
-        res = SC_pcre2_substring_copy(
+        res = SC_Pcre2SubstringCopy(
                 parse_regex.match, ENDIAN_VAL, (PCRE2_UCHAR8 *)tmp_str, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
@@ -445,7 +445,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch
 
     if (ret > STRING_VAL) {
         pcre2len = sizeof(tmp_str);
-        res = SC_pcre2_substring_copy(
+        res = SC_Pcre2SubstringCopy(
                 parse_regex.match, STRING_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
@@ -458,7 +458,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch
         }
 
         pcre2len = sizeof(tmp_str);
-        res = SC_pcre2_substring_copy(
+        res = SC_Pcre2SubstringCopy(
                 parse_regex.match, STRING_VAL, (PCRE2_UCHAR8 *)tmp_str, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
@@ -478,8 +478,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch
 
     if (ret > DCE_KW) {
         pcre2len = sizeof(tmp_str);
-        res = SC_pcre2_substring_copy(
-                parse_regex.match, DCE_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len);
+        res = SC_Pcre2SubstringCopy(parse_regex.match, DCE_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed "
                                                   "for byte_math \"dce\" arg");
index 962b98404f1cf4e6e9b65adef3578918bf12e9d8..62c0b58f770e5192f9a516146b7cb4f6cb9a57f6 100644 (file)
@@ -156,7 +156,7 @@ static DetectDsizeData *DetectDsizeParse (const char *rawstr)
     }
 
     pcre2len = sizeof(mode);
-    res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
+    res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed with %d", res);
         goto error;
index 87cf12793d63abcb84f5b0a8d3e2e40c625efee8..eb79407279502f8e23ad48f97d0ae19a1af3c041 100644 (file)
@@ -158,7 +158,7 @@ static DetectFilesizeData *DetectFilesizeParse (const char *str)
 
     SCLogDebug("ret %d", ret);
 
-    res = SC_pcre2_substring_get(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+    res = SC_Pcre2SubstringGet(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
         goto error;
index d2edbe27048a7b464b69e4fcc336b59a2ff5a918..d4e095f9d1a97692b630a72b007cc88ee3d1bb36 100644 (file)
@@ -185,7 +185,7 @@ static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flo
 
     if (ret > 1) {
         pcre2len = sizeof(str1);
-        res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)str1, &pcre2len);
+        res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)str1, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
             goto error;
index f5866815a769f84dbbb6d89c987928d438f1f6e9..94d26549503905ee43e747fb4f0e84de9d1aa791 100644 (file)
@@ -183,8 +183,7 @@ static DetectFragBitsData *DetectFragBitsParse (const char *rawstr)
     }
 
     for (i = 0; i < (ret - 1); i++) {
-        res = SC_pcre2_substring_get(
-                parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+        res = SC_Pcre2SubstringGet(parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed %d", res);
             goto error;
index d8647f37747654d8f1f763aa281f3fb78a94939b..fcfdcc000f87bcf67fcfc167982a2ad1ce1680ff 100644 (file)
@@ -156,7 +156,7 @@ static DetectFragOffsetData *DetectFragOffsetParse (DetectEngineCtx *de_ctx, con
     }
 
     for (i = 1; i < ret; i++) {
-        res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+        res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
             goto error;
index 3dea8ad4fa72cacac2b7961dfd128d816975b6c9..7e943ca0b4220a2b992a7bf716c35db37f49fe22 100644 (file)
@@ -172,7 +172,7 @@ static DetectIcmpIdData *DetectIcmpIdParse (DetectEngineCtx *de_ctx, const char
     int i;
     const char *str_ptr;
     for (i = 1; i < ret; i++) {
-        res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+        res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
             goto error;
index 707eab7e033eb2b272e3b90aaf7e54ed842a9e8c..d4f2fcf7b2bfe146204bcc79527cd8801be683a6 100644 (file)
@@ -174,7 +174,7 @@ static DetectIcmpSeqData *DetectIcmpSeqParse (DetectEngineCtx *de_ctx, const cha
     }
 
     for (i = 1; i < ret; i++) {
-        res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+        res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
             goto error;
index e106ea2c1fbeacf498706aa6de3bd4aa10cb0a48..814db8efec1da033d8d6bd8af5ba4b256456137f 100644 (file)
@@ -163,7 +163,7 @@ static DetectICodeData *DetectICodeParse(DetectEngineCtx *de_ctx, const char *ic
     int i;
     const char *str_ptr;
     for (i = 1; i < ret; i++) {
-        res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+        res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
             goto error;
index 9663f194a5b0b631aac30cd12a5425ae228b5944..4b2ac13a405281ca2c9a83d20ad3cd4a747ae1c3 100644 (file)
@@ -163,7 +163,7 @@ static DetectITypeData *DetectITypeParse(DetectEngineCtx *de_ctx, const char *it
     int i;
     const char *str_ptr;
     for (i = 1; i < ret; i++) {
-        res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+        res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
             goto error;
index 22d0097f738ecdf2bc031024af4316d870ddda9c..782ac9486cb3d23cb20eb36c674559f4b9c6cb68 100644 (file)
@@ -218,7 +218,7 @@ static DetectNfsProcedureData *DetectNfsProcedureParse (const char *rawstr)
     }
 
     pcre2len = sizeof(mode);
-    res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
+    res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
         goto error;
index 63b4345eb8cd6b8bc04a32a7d29e50ba45b55b97..f30c308743c60fd06b1d49f90742e2deef355ef8 100644 (file)
@@ -209,7 +209,7 @@ static DetectNfsVersionData *DetectNfsVersionParse (const char *rawstr)
     }
 
     pcre2len = sizeof(mode);
-    res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
+    res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
         goto error;
index e4491d8e12c68eeda45733642df6be6c6d7f5493..3e4f1a225c1c66abd3a01d2c1e9e864dc18a3632 100644 (file)
@@ -2531,7 +2531,7 @@ DetectParseRegex *DetectSetupPCRE2(const char *parse_str, int opts)
     return detect_parse;
 }
 
-int SC_pcre2_substring_copy(
+int SC_Pcre2SubstringCopy(
         pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen)
 {
     int r = pcre2_substring_copy_bynumber(match_data, number, buffer, bufflen);
@@ -2543,7 +2543,7 @@ int SC_pcre2_substring_copy(
     return r;
 }
 
-int SC_pcre2_substring_get(
+int SC_Pcre2SubstringGet(
         pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen)
 {
     int r = pcre2_substring_get_bynumber(match_data, number, bufferptr, bufflen);
index 049b130996d1d90b1683b3c6654870e3351d8842..021dcbf4b8f968c35910c2d749b38bcc14a6329d 100644 (file)
@@ -96,9 +96,9 @@ void DetectParseFreeRegex(DetectParseRegex *r);
 /* parse regex exec */
 int DetectParsePcreExec(
         DetectParseRegex *parse_regex, const char *str, int start_offset, int options);
-int SC_pcre2_substring_copy(
+int SC_Pcre2SubstringCopy(
         pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen);
-int SC_pcre2_substring_get(pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR **bufferptr,
+int SC_Pcre2SubstringGet(pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR **bufferptr,
         PCRE2_SIZE *bufflen);
 
 #endif /* __DETECT_PARSE_H__ */
index d55965e78bbd25855c0c54a386a41f47f61b31b6..f6ac936c60e2a717681337a09f4246256a7732fb 100644 (file)
@@ -174,7 +174,7 @@ static DetectRfbSectypeData *DetectRfbSectypeParse (const char *rawstr)
     }
 
     pcre2len = sizeof(mode);
-    res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
+    res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
         goto error;
index 56e12cf45512905f20fccd687a3c4e1bb13dd8f4..d42f3eef0da3d464f261d55a76e3eedb44dd739b 100644 (file)
@@ -188,7 +188,7 @@ static DetectSNMPVersionData *DetectSNMPVersionParse (const char *rawstr)
     }
 
     pcre2len = sizeof(mode);
-    res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
+    res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
         goto error;
index 9a1b67392d0d117b95385e032430b462e66c96f5..505254852d2475b6110228bc125b14d3765b2929 100644 (file)
@@ -189,7 +189,7 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr)
     }
 
     pcre2len = sizeof(arg1);
-    res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len);
+    res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
         SCReturnPtr(NULL, "DetectFlagsData");
@@ -204,7 +204,7 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr)
     }
     if (ret >= 3) {
         pcre2len = sizeof(arg3);
-        res = SC_pcre2_substring_copy(parse_regex.match, 3, (PCRE2_UCHAR8 *)arg3, &pcre2len);
+        res = SC_Pcre2SubstringCopy(parse_regex.match, 3, (PCRE2_UCHAR8 *)arg3, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
             SCReturnPtr(NULL, "DetectFlagsData");
index 97d1c9a6f3a47e5f5de3a91d4bd550b6d192edfa..de25663db995c57762e2fa2ac07e2ae982ab66ba 100644 (file)
@@ -127,7 +127,7 @@ static DetectWindowData *DetectWindowParse(DetectEngineCtx *de_ctx, const char *
     if (ret > 1) {
         char copy_str[128] = "";
         pcre2len = sizeof(copy_str);
-        res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)copy_str, &pcre2len);
+        res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)copy_str, &pcre2len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
             goto error;
index d89cf09ab499e63982ac2975da48949caaef4037..7be4d5bdf885f7600e4a5a6aed313870338d80d4 100644 (file)
@@ -319,7 +319,7 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
     }
 
     pcre2len = sizeof(mode);
-    res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
+    res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed");
         goto error;
index e9127ee854612d3cf958912dd0a85678d52573ca..feb61d2acb49c1785c33fbcbb9643c3292cf40f1 100644 (file)
@@ -108,7 +108,7 @@ static DetectUrilenData *DetectUrilenParse (const char *urilenstr)
 
     SCLogDebug("ret %d", ret);
 
-    res = SC_pcre2_substring_get(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+    res = SC_Pcre2SubstringGet(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
     if (res < 0) {
         SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
         goto error;
@@ -125,7 +125,7 @@ static DetectUrilenData *DetectUrilenParse (const char *urilenstr)
     SCLogDebug("Arg2 \"%s\"", arg2);
 
     if (ret > 3) {
-        res = SC_pcre2_substring_get(parse_regex.match, 3, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+        res = SC_Pcre2SubstringGet(parse_regex.match, 3, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
         if (res < 0) {
             SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
             goto error;
@@ -134,8 +134,7 @@ static DetectUrilenData *DetectUrilenParse (const char *urilenstr)
         SCLogDebug("Arg3 \"%s\"", arg3);
 
         if (ret > 4) {
-            res = SC_pcre2_substring_get(
-                    parse_regex.match, 4, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
+            res = SC_Pcre2SubstringGet(parse_regex.match, 4, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
             if (res < 0) {
                 SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed");
                 goto error;