[nginx] Restored zeroing of ngx_channel_t in ngx_pass_open_channel().

Ruslan Ermilov ru at nginx.com
Thu Apr 22 13:19:22 UTC 2021


details:   https://hg.nginx.org/nginx/rev/f2ff291bbdac
branches:  
changeset: 7830:f2ff291bbdac
user:      Ruslan Ermilov <ru at nginx.com>
date:      Thu Apr 22 16:12:52 2021 +0300
description:
Restored zeroing of ngx_channel_t in ngx_pass_open_channel().

Due to structure's alignment, some uninitialized memory contents may have
been passed between processes.

Zeroing was removed in 0215ec9aaa8a.

Reported by Johnny Wang.

diffstat:

 src/os/unix/ngx_process_cycle.c |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 2851e4c7de03 -r f2ff291bbdac src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c	Wed Apr 21 23:24:59 2021 +0300
+++ b/src/os/unix/ngx_process_cycle.c	Thu Apr 22 16:12:52 2021 +0300
@@ -398,6 +398,8 @@ ngx_pass_open_channel(ngx_cycle_t *cycle
     ngx_int_t      i;
     ngx_channel_t  ch;
 
+    ngx_memzero(&ch, sizeof(ngx_channel_t));
+
     ch.command = NGX_CMD_OPEN_CHANNEL;
     ch.pid = ngx_processes[ngx_process_slot].pid;
     ch.slot = ngx_process_slot;


More information about the nginx-devel mailing list