From df0dfa634d54904ea9e0714547547131a6b2da10 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 2 Oct 2018 13:32:52 +0300 Subject: [PATCH] Fixed off-by-one error in shared zone initialization. On systems without atomic ops, not enough space was allocated for mutex's file name during shared zone initialization. --- src/core/ngx_cycle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index f3ac24d7a..083c76488 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -921,7 +921,8 @@ ngx_init_zone_pool(ngx_cycle_t *cycle, ngx_shm_zone_t *zn) #else - file = ngx_pnalloc(cycle->pool, cycle->lock_file.len + zn->shm.name.len); + file = ngx_pnalloc(cycle->pool, + cycle->lock_file.len + zn->shm.name.len + 1); if (file == NULL) { return NGX_ERROR; }