]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/content: use const pointer where possible
authorVictor Julien <vjulien@oisf.net>
Fri, 22 Sep 2023 08:14:11 +0000 (10:14 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 1 Dec 2023 13:55:42 +0000 (14:55 +0100)
src/detect-engine-content-inspection.c
src/detect-replace.c
src/detect-replace.h
src/detect.h

index 4569cd7139819cab0cde01c69af18964c024c70a..242ad03fa120aed2a1db00d4d092243f5776abde 100644 (file)
@@ -126,8 +126,7 @@ int DetectEngineContentInspectionInternal(DetectEngineCtx *de_ctx, DetectEngineT
 
     /* \todo unify this which is phase 2 of payload inspection unification */
     if (smd->type == DETECT_CONTENT) {
-
-        DetectContentData *cd = (DetectContentData *)smd->ctx;
+        const DetectContentData *cd = (const DetectContentData *)smd->ctx;
         SCLogDebug("inspecting content %"PRIu32" buffer_len %"PRIu32, cd->id, buffer_len);
 
         /* we might have already have this content matched by the mpm.
index 147c3e94d8b175d439a70931281a5958847b09f8..e70a2e1677a49179521e94ab3eeed0d76df3484c 100644 (file)
@@ -176,9 +176,8 @@ error:
  * earlier changes. Thus the highest priority modifications should be
  * applied last.
  */
-DetectReplaceList *DetectReplaceAddToList(DetectReplaceList *replist,
-                                          uint8_t *found,
-                                          DetectContentData *cd)
+DetectReplaceList *DetectReplaceAddToList(
+        DetectReplaceList *replist, uint8_t *found, const DetectContentData *cd)
 {
     DetectReplaceList *newlist;
 
index c444188c094880ce800837ab4b48f948e6ab7646..4944420527e873587c85e1f6d89e0a99a2e2de4d 100644 (file)
@@ -26,7 +26,8 @@
 
 #include "detect-content.h"
 
-DetectReplaceList * DetectReplaceAddToList(DetectReplaceList *replist, uint8_t *found, DetectContentData *cd);
+DetectReplaceList *DetectReplaceAddToList(
+        DetectReplaceList *replist, uint8_t *found, const DetectContentData *cd);
 
 /* Internal functions are only called via the inline functions below. */
 void DetectReplaceExecuteInternal(Packet *p, DetectReplaceList *replist);
index e30bac279a06c8cbcc7df90fd80acb3755f9cc0a..53ca2b0931f6c1566a0389c91bf7fa2ee15702c2 100644 (file)
@@ -721,7 +721,7 @@ typedef struct DetectPatternTracker {
 } DetectPatternTracker;
 
 typedef struct DetectReplaceList_ {
-    struct DetectContentData_ *cd;
+    const struct DetectContentData_ *cd;
     uint8_t *found;
     struct DetectReplaceList_ *next;
 } DetectReplaceList;