diff options
| author | luwenpeng <[email protected]> | 2020-07-15 14:12:52 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2020-07-15 14:12:59 +0800 |
| commit | d55f2e36d369e3ea5f52d199a811aaca49cc2280 (patch) | |
| tree | c553bb7c8eaf591acba30b83c836987b12d340d9 /plugin | |
| parent | a409b054206c42020c9da0e4e1f5594900402542 (diff) | |
DOH 修复潜在问题:maat 命中策略数过多导致数组越界
类似于 Pangu (TSG-2535 Main Board统计中出现负数Policy Id的数据)的问题
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/business/doh/src/doh.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugin/business/doh/src/doh.cpp b/plugin/business/doh/src/doh.cpp index fbd177c..259be99 100644 --- a/plugin/business/doh/src/doh.cpp +++ b/plugin/business/doh/src/doh.cpp @@ -1,6 +1,6 @@ #include "logger.h" -#define MAX_SCAN_RESULT 128 +#define MAX_SCAN_RESULT 16 #define DOH_CTX_MAGIC_NUM 20200601 #define REQ_METHOD_IS_GET(method) ((method == TFE_HTTP_METHOD_GET) ? 1 : 0) @@ -182,7 +182,7 @@ static struct Maat_rule_t *doh_fetch_rule(Maat_rule_t *result, int result_num) int i = 0; Maat_rule_t *p_result = NULL; - for (i = 0; i < result_num; i++) + for (i = 0; i < result_num && i < MAX_SCAN_RESULT; i++) { if (p_result == NULL) { @@ -748,6 +748,7 @@ int doh_on_init(struct tfe_proxy *proxy) TFE_LOG_INFO(NULL, "Doh disabled."); goto success; } + TFE_LOG_INFO(NULL, "Doh enabled."); g_doh_conf->thread_num = tfe_proxy_get_work_thread_count(); g_doh_conf->local_logger = MESA_create_runtime_log_handle("./log/doh_pxy.log", g_doh_conf->local_level); @@ -771,6 +772,7 @@ int doh_on_init(struct tfe_proxy *proxy) TFE_LOG_ERROR(NULL, "Doh init maat failed."); goto error; } + TFE_LOG_INFO(g_doh_conf->local_logger, "Doh init success."); success: return 0; |
