summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <[email protected]>2024-10-28 09:25:46 +0000
committerroot <[email protected]>2024-10-28 09:25:46 +0000
commitabd00a9aab474d300c00088a060766bc2f5f802b (patch)
tree847e716a8bcd421a78e417fcb71d7a4718e1aa48
parent816dabaf9e2bcc04e96c861c93f2aa354040339c (diff)
add some detail info for log
-rw-r--r--scanner/expr_matcher/expr_matcher.cpp6
-rw-r--r--src/maat_expr.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/scanner/expr_matcher/expr_matcher.cpp b/scanner/expr_matcher/expr_matcher.cpp
index 4b8360a..ee78fb7 100644
--- a/scanner/expr_matcher/expr_matcher.cpp
+++ b/scanner/expr_matcher/expr_matcher.cpp
@@ -156,9 +156,11 @@ static int expr_rule_pattern_count(struct expr_rule *rules, size_t n_rule,
for (size_t j = 0; j < rules[i].n_patterns; j++) {
/* pat_len should not 0 */
if (0 == rules[i].patterns[j].pat_len) {
+ char uuid_str[37];
+ uuid_unparse(rules[i].expr_uuid, uuid_str);
log_fatal(logger, MODULE_EXPR_MATCHER,
- "[%s:%d] expr pattern length should not 0",
- __FUNCTION__, __LINE__);
+ "[%s:%d] expr rule %s pattern length should not 0",
+ __FUNCTION__, __LINE__, uuid_str);
return -1;
}
diff --git a/src/maat_expr.c b/src/maat_expr.c
index 79edba6..51807d8 100644
--- a/src/maat_expr.c
+++ b/src/maat_expr.c
@@ -508,6 +508,10 @@ static int expr_keywords_to_expr_pattern(char *keywords, struct expr_pattern *pa
pattern->pat_len = pattern_len;
}
+ if (pattern->pat_len == 0) {
+ return -1;
+ }
+
return 0;
}