Skip to content

The limit specified by body_max_count is not really the maximum that is allowed #4

@agentzh

Description

@agentzh

People tend to think the limit specified by body_max_count is the maximum that is allowed. But one cannot actually achieve that number. For example, if we have

body_max_count 3;

then only 2 query args are accepted. It makes sense to accept 3 args but reject more. The following patch fixes this:

diff --git a/ngx_hashdos_module.c b/ngx_hashdos_module.c
index 535b993..d3466a6 100644
--- a/ngx_hashdos_module.c
+++ b/ngx_hashdos_module.c
@@ -227,7 +227,7 @@ ngx_hashdos_request_body_handler(ngx_http_request_t *r)
     }
     ++count;
     ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,"[hashdos] parse     request body params count is .... %O, limit is %O", count, limit);
-    if(count >= limit){
+    if(count > limit){
         (void) ngx_http_discard_request_body(r);
         ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);    
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions