[nginx] Fixed off-by-one error in shared zone initialization.

Ruslan Ermilov ru at nginx.com
Tue Oct 2 10:33:33 UTC 2018


details:   http://hg.nginx.org/nginx/rev/7bf3c323cb6e
branches:  
changeset: 7366:7bf3c323cb6e
user:      Ruslan Ermilov <ru at nginx.com>
date:      Tue Oct 02 13:32:52 2018 +0300
description:
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.

diffstat:

 src/core/ngx_cycle.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r cd4fa2fab8d8 -r 7bf3c323cb6e src/core/ngx_cycle.c
--- a/src/core/ngx_cycle.c	Tue Sep 25 14:07:59 2018 +0300
+++ b/src/core/ngx_cycle.c	Tue Oct 02 13:32:52 2018 +0300
@@ -921,7 +921,8 @@ ngx_init_zone_pool(ngx_cycle_t *cycle, n
 
 #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;
     }


More information about the nginx-devel mailing list