diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-07-19 13:52:56 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2011-07-19 13:52:56 +0000 |
commit | 5a80933ea069e2d307c9f384bade51d5618b56e0 (patch) | |
tree | 29e935400833d6a86439782d9cdcd7cd1a2f389a | |
parent | 71c68329951f5e9dd6c5aa42b47c0bd9d3e2e310 (diff) | |
download | nginx-5a80933ea069e2d307c9f384bade51d5618b56e0.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 e8d87738f..62f1669c7 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -666,6 +666,15 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u) ngx_http_file_cache_create_key(r); + if (r->cache->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 = r->cache; |