]> git.kaiwu.me - nginx.git/commitdiff
Fixed off-by-one error in shared zone initialization.
authorRuslan Ermilov <ru@nginx.com>
Tue, 2 Oct 2018 10:32:52 +0000 (13:32 +0300)
committerRuslan Ermilov <ru@nginx.com>
Tue, 2 Oct 2018 10:32:52 +0000 (13:32 +0300)
On systems without atomic ops, not enough space was allocated
for mutex's file name during shared zone initialization.

src/core/ngx_cycle.c

index f3ac24d7a592a86a655d3c62a6d46bba1e3ce20c..083c76488a597f66eb8e52c53b5d444b482b7472 100644 (file)
@@ -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;
     }