diff --git a/CHANGES b/CHANGES index 2964afb3..8b2c1687 100644 --- a/CHANGES +++ b/CHANGES @@ -25,7 +25,7 @@ * Fixed bug when use ctl:ruleRemoveTargetByTag. - * Fixed many IIS port bugs. + * Fixed IIS and NGINX modules bugs. * Fixed bug when @strmatch patterns use invalid escape sequence (Thanks Hideaki Hayashi). diff --git a/nginx/modsecurity/ngx_http_modsecurity.c b/nginx/modsecurity/ngx_http_modsecurity.c index 5b4cbda9..683727b4 100644 --- a/nginx/modsecurity/ngx_http_modsecurity.c +++ b/nginx/modsecurity/ngx_http_modsecurity.c @@ -488,6 +488,9 @@ ngx_http_do_read_upload_client_request_body(ngx_http_request_t *r) if (rb->buf->last == rb->buf->end) { rc = ngx_http_process_request_body(r, rb->to_write); + if(rc != NGX_OK) { + return rc; + } rb->to_write = rb->bufs->next ? rb->bufs->next : rb->bufs; rb->buf->last = rb->buf->start; @@ -555,7 +558,10 @@ ngx_http_do_read_upload_client_request_body(ngx_http_request_t *r) ngx_del_timer(c->read); } - ngx_http_process_request_body(r, rb->to_write); + rc = ngx_http_process_request_body(r, rb->to_write); + if(rc != NGX_OK) { + return rc; + } return ngx_http_upload_body_handler(r); } @@ -779,7 +785,7 @@ modsecurity_read_body_cb(request_rec *r, char *buf, unsigned int length, if (!ctx->body_pos) { ctx->body_pos = b->start; } - if ((b->end - ctx->body_pos) > length) { + if ((unsigned int)(b->end - ctx->body_pos) > length) { ngx_memcpy(buf, (char *) ctx->body_pos, length); ctx->processed += length; ctx->body_pos += length;