diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-07-19 14:15:50 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2011-07-19 14:15:50 +0000 |
commit | e0ec6a04f57f55863db501c79fd66a3e5fba0afd (patch) | |
tree | 92d5d52692f1348834f3fd63c00129a88498719d | |
parent | 97bf815054a17f6b2972000d88dabcbc135f02e0 (diff) | |
download | nginx-e0ec6a04f57f55863db501c79fd66a3e5fba0afd.tar.gz |
merge r3945:
fix segfault if cache key is larger than upstream buffer size
patch by Lanshun Zhou
-rw-r--r-- | src/http/ngx_http_upstream.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 4e3c3ed76..e9aa9f1d3 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -620,6 +620,15 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u) ngx_http_file_cache_create_key(r); + if (c->header_start >= u->conf->buffer_size) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "cache key too large, increase upstream buffer size %uz", + u->conf->buffer_size); + + r->cache = NULL; + return NGX_DECLINED; + } + u->cacheable = 1; c->min_uses = u->conf->cache_min_uses; |