mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-13 05:51:46 +00:00
Allocate only the required memory on POST instead of max. Increased max a bit.
This commit is contained in:
parent
ddea68f245
commit
2a285ff7d3
4 changed files with 15 additions and 4 deletions
|
|
@ -12213,11 +12213,16 @@ int LuaEngine::handle_script_request(struct mg_connection *conn,
|
|||
|
||||
/* Check for POST requests */
|
||||
if((strcmp(request_info->request_method, "POST") == 0) && (content_type != NULL)) {
|
||||
if((post_data = (char*)malloc(HTTP_MAX_POST_DATA_LEN * sizeof(char))) == NULL
|
||||
|| (post_data_len = mg_read(conn, post_data, HTTP_MAX_POST_DATA_LEN)) == 0) {
|
||||
int content_len = mg_get_content_len(conn)+1;
|
||||
|
||||
if (content_len > HTTP_MAX_POST_DATA_LEN)
|
||||
content_len = HTTP_MAX_POST_DATA_LEN;
|
||||
|
||||
if((post_data = (char*)malloc(content_len * sizeof(char))) == NULL
|
||||
|| (post_data_len = mg_read(conn, post_data, content_len)) == 0) {
|
||||
valid_csrf = 0;
|
||||
|
||||
} else if(post_data_len > HTTP_MAX_POST_DATA_LEN - 1) {
|
||||
} else if(post_data_len > content_len - 1) {
|
||||
ntop->getTrace()->traceEvent(TRACE_WARNING,
|
||||
"Too much data submitted with the form. [post_data_len: %u]",
|
||||
post_data_len);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue