comparison src/core/ngx_hash.c @ 6081:12ab5cd445c0 stable-1.6

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 dfb23e4361da
children ddf35e019a80
comparison
equal deleted inserted replaced
6080:4296627f385a 6081:12ab5cd445c0
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",