From 0a4685f2ab1feef27b410027ce06dfb5eb71d910 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 2 May 2026 12:25:47 +0200 Subject: [PATCH] detect/pcre: fix compile warnings detect-pcre.c:419:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 419 | char *fcap = strstr(regexstr, "flow:"); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ detect-pcre.c:420:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 420 | char *pcap = strstr(regexstr, "pkt:"); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~ detect-pcre.c:421:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 421 | char *acap = strstr(regexstr, "alert:"); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 errors generated. --- src/detect-pcre.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/detect-pcre.c b/src/detect-pcre.c index 9e086807c9..3213d7d3a5 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -416,9 +416,9 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx, bool apply_match_limit = false; int cut_capture = 0; - char *fcap = strstr(regexstr, "flow:"); - char *pcap = strstr(regexstr, "pkt:"); - char *acap = strstr(regexstr, "alert:"); + const char *fcap = strstr(regexstr, "flow:"); + const char *pcap = strstr(regexstr, "pkt:"); + const char *acap = strstr(regexstr, "alert:"); /* take the size of the whole input as buffer size for the regex we will * extract below. Add 1 to please Coverity's alloc_strlen test. */ size_t slen = strlen(regexstr) + 1;