Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Fix "$upstream_response_length" for upstream requests with buffering off

Piotr Sikora
April 11, 2013 02:42PM
Hey Maxim,

> The patch is wrong as u->pipe might not exists at all, and the
> code will result in null pointer dereference.

Argh, I was actually looking yesterday whether this might be the case,
but I didn't find a code path that would result in u->pipe not being
allocated... It seems that I totally forgot about memcached and my own
upstream modules... Good catch, thanks!

> Correct patch should be:
>
> --- a/src/http/ngx_http_upstream.c
> +++ b/src/http/ngx_http_upstream.c
> @@ -3307,7 +3307,7 @@ ngx_http_upstream_finalize_request(ngx_h
> u->state->response_sec = tp->sec - u->state->response_sec;
> u->state->response_msec = tp->msec - u->state->response_msec;
>
> - if (u->pipe) {
> + if (u->pipe && u->pipe->read_length) {
> u->state->response_length = u->pipe->read_length;
> }
> }
>
> Is it looks good for you?

Yeah, thanks!

Best regards,
Piotr Sikora

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Fix "$upstream_response_length" for upstream requests with buffering off

Piotr Sikora 921 April 11, 2013 12:40AM

Re: [PATCH] Fix "$upstream_response_length" for upstream requests with buffering off

Maxim Dounin 620 April 11, 2013 07:30AM

Re: [PATCH] Fix "$upstream_response_length" for upstream requests with buffering off

Piotr Sikora 378 April 11, 2013 02:42PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 259
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready