comparison src/core/ngx_hash.c @ 5985:f961c719fb09

Core: fixed potential buffer overrun when initializing hash. Initial size as calculated from the number of elements may be bigger than max_size. If this happens, make sure to set size to max_size. Reported by Chris West.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 24 Feb 2015 18:37:14 +0300
parents 5e72578e6503
children ddf35e019a80
comparison
equal deleted inserted replaced
5984:3f568dd68af1 5985:f961c719fb09
310 next: 310 next:
311 311
312 continue; 312 continue;
313 } 313 }
314 314
315 size--; 315 size = hinit->max_size;
316 316
317 ngx_log_error(NGX_LOG_WARN, hinit->pool->log, 0, 317 ngx_log_error(NGX_LOG_WARN, hinit->pool->log, 0,
318 "could not build optimal %s, you should increase " 318 "could not build optimal %s, you should increase "
319 "either %s_max_size: %i or %s_bucket_size: %i; " 319 "either %s_max_size: %i or %s_bucket_size: %i; "
320 "ignoring %s_bucket_size", 320 "ignoring %s_bucket_size",