diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-07-19 11:24:16 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2011-07-19 11:24:16 +0000 |
commit | 6c3c3bbe4254b2f2d65e4a27ed2618b37391606c (patch) | |
tree | 27bd137209b02a9a2b6645e3b5c3f5775e013a75 /src | |
parent | 82afb9cc86c39ae3ff9b79a24912e36c85e9b724 (diff) | |
download | nginx-6c3c3bbe4254b2f2d65e4a27ed2618b37391606c.tar.gz nginx-6c3c3bbe4254b2f2d65e4a27ed2618b37391606c.zip |
fix segfault if cache key is larger than upstream buffer size
patch by Lanshun Zhou
Diffstat (limited to 'src')
-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 f9f09cb34..ad5b449ec 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -661,6 +661,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; + } + switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) { case NGX_ERROR: |