DOH 修复潜在问题:maat 命中策略数过多导致数组越界
类似于 Pangu (TSG-2535 Main Board统计中出现负数Policy Id的数据)的问题
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
#define MAX_SCAN_RESULT 128
|
#define MAX_SCAN_RESULT 16
|
||||||
#define DOH_CTX_MAGIC_NUM 20200601
|
#define DOH_CTX_MAGIC_NUM 20200601
|
||||||
|
|
||||||
#define REQ_METHOD_IS_GET(method) ((method == TFE_HTTP_METHOD_GET) ? 1 : 0)
|
#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;
|
int i = 0;
|
||||||
Maat_rule_t *p_result = NULL;
|
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)
|
if (p_result == NULL)
|
||||||
{
|
{
|
||||||
@@ -748,6 +748,7 @@ int doh_on_init(struct tfe_proxy *proxy)
|
|||||||
TFE_LOG_INFO(NULL, "Doh disabled.");
|
TFE_LOG_INFO(NULL, "Doh disabled.");
|
||||||
goto success;
|
goto success;
|
||||||
}
|
}
|
||||||
|
TFE_LOG_INFO(NULL, "Doh enabled.");
|
||||||
|
|
||||||
g_doh_conf->thread_num = tfe_proxy_get_work_thread_count();
|
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);
|
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.");
|
TFE_LOG_ERROR(NULL, "Doh init maat failed.");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
TFE_LOG_INFO(g_doh_conf->local_logger, "Doh init success.");
|
||||||
|
|
||||||
success:
|
success:
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user