From afab73ad5f87a945d3b8018ead6ce5a99a1c5eed Mon Sep 17 00:00:00 2001 From: fengweihao Date: Thu, 30 Jul 2020 10:38:02 +0800 Subject: [PATCH] =?UTF-8?q?TSG-2641=20=E4=BF=AE=E5=A4=8D=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=91=BD=E4=B8=AD=E7=AD=96=E7=95=A5=E8=B6=85?= =?UTF-8?q?=E8=BF=8716=E6=9D=A1=EF=BC=8C=E8=B6=8A=E7=95=8C=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scan/src/pangu_http.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scan/src/pangu_http.cpp b/scan/src/pangu_http.cpp index 4e1b96c..43de1d6 100644 --- a/scan/src/pangu_http.cpp +++ b/scan/src/pangu_http.cpp @@ -355,7 +355,7 @@ static enum pangu_action decide_ctrl_action(const struct Maat_rule_t * hit_rules struct Maat_rule_t monit_rule[n_hit]; enum pangu_action prior_action = PG_ACTION_NONE; - for (i = 0; i < n_hit; i++) + for (i = 0; i < n_hit && i < MAX_SCAN_RESULT ; i++) { unsigned char __expand_action = (unsigned char) hit_rules[i].action; enum pangu_action __action = (enum pangu_action) __expand_action; @@ -493,6 +493,8 @@ static int http_hit_policy_list(Maat_feather_t maat, size_t hit_cnt, cJSON *data return 0; } + if (hit_cnt >= MAX_SCAN_RESULT) hit_cnt = MAX_SCAN_RESULT; + ret = Maat_rule_sort_by_evaluation_order(maat, ctx->result, hit_cnt); if (ret != hit_cnt) {