diff --git a/src/detect-parse.c b/src/detect-parse.c index 6a7c9d7684..08de671db7 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -2058,8 +2058,12 @@ static int SigParseBasics(DetectEngineCtx *de_ctx, Signature *s, const char *sig while (isspace(*index) || *index == '(') { index++; } + bool closing = false; for (size_t i = strlen(index); i > 0; i--) { - if (isspace(index[i - 1]) || index[i - 1] == ')') { + if (index[i - 1] == ')') { + closing = true; + index[i - 1] = '\0'; + } else if (isspace(index[i - 1])) { index[i - 1] = '\0'; } else { break; @@ -2071,6 +2075,11 @@ static int SigParseBasics(DetectEngineCtx *de_ctx, Signature *s, const char *sig return 0; } + if (!closing && de_ctx->rule_file) { + SCLogWarning( + "Rule missing closing parenthesis at %s:%u", de_ctx->rule_file, de_ctx->rule_line); + } + /* Parse Action */ if (SigParseAction(s, parser->action) < 0) goto error;