diff --git a/plugin/business/pangu-http/pangu_http.cpp b/plugin/business/pangu-http/pangu_http.cpp index 224a56a..ac7fb68 100644 --- a/plugin/business/pangu-http/pangu_http.cpp +++ b/plugin/business/pangu-http/pangu_http.cpp @@ -391,9 +391,8 @@ static void html_generate(int status_code, int cfg_id, const char* msg, char ** } tpl->Expand(&output, &dict); - *page_size = output.length(); - *page_buff = ALLOC(char, *page_size); - memcpy(*page_buff, output.c_str(), *page_size); + *page_size = output.length() + 1; + *page_buff = strdup(output.c_str()); } static void html_free(char ** page_buff) @@ -576,7 +575,8 @@ static void http_reject(const struct tfe_http_session * session, enum tfe_http_e { TFE_LOG_ERROR(g_pangu_rt->local_logger, "Invalid reject rule %d paramter %s", ctx->enforce_rules[0].config_id, ctx->enforce_para); - ctx->action==PG_ACTION_NONE; + + ctx->action = PG_ACTION_NONE; goto error_out; } @@ -631,7 +631,6 @@ static void http_redirect(const struct tfe_http_session * session, enum tfe_http error_out: free(url); - return; } enum pangu_action http_scan(const struct tfe_http_session * session, enum tfe_http_event events,