From: Eric Leblond Date: Mon, 9 Jun 2025 09:14:37 +0000 (+0200) Subject: detect/pcre: fix error handling X-Git-Tag: suricata-8.0.0-rc1~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0f172e721dc7d8a94518166163e5e65eafaab60b;p=thirdparty%2Fsuricata.git detect/pcre: fix error handling --- diff --git a/src/detect-pcre.c b/src/detect-pcre.c index a3520e6305..df364902c1 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -180,6 +180,13 @@ static void DetectAlertStoreMatch(DetectEngineThreadCtx *det_ctx, const Signatur if (js_len > SIG_JSON_CONTENT_ITEM_LEN) { SCLogDebug("Captured length is too long for JSON."); SCFree(str_ptr); + SCJbFree(js); + return; + } + if (js_len == 0) { + SCLogDebug("Captured length is zero for JSON."); + SCFree(str_ptr); + SCJbFree(js); return; } /* Copy js but skip the starting curly bracket to just get the inner data */