[Tarantool-patches] [PATCH] popen: add missing ev_io initialization

Cyrill Gorcunov gorcunov at gmail.com
Mon Mar 23 10:24:44 MSK 2020


Otherwise it left unitialized and in result
may not work depending on dirty data got from
memory.

Fixes #4811

Reported-by: Nikita Pettik <korablev at tarantool.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
branch gorcunov/gh-4811-popen-coio

 src/lib/core/popen.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index a0630e3d9..99bd69b74 100644
--- a/src/lib/core/popen.c
+++ b/src/lib/core/popen.c
@@ -115,12 +115,8 @@ handle_new(struct popen_opts *opts)
 
 	rlist_create(&handle->list);
 
-	/*
-	 * No need to initialize the whole ios structure,
-	 * just set fd value to mark as unused.
-	 */
 	for (i = 0; i < lengthof(handle->ios); i++)
-		handle->ios[i].fd = -1;
+		coio_create(&handle->ios[i], -1);
 
 	say_debug("popen: alloc handle %p command '%s' flags %#x",
 		  handle, handle->command, opts->flags);
-- 
2.20.1



More information about the Tarantool-patches mailing list