From bb0279b73268da118462af98f206ee3f706c310a Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 19 Sep 2020 23:59:59 +0100 Subject: [PATCH] ecore - efl exe - check returns of open and dup2 for stdin etc. fds check returns - fix CID 1397002 --- src/lib/ecore/efl_exe.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/ecore/efl_exe.c b/src/lib/ecore/efl_exe.c index 03c52ab..7239bcd 100644 --- a/src/lib/ecore/efl_exe.c +++ b/src/lib/ecore/efl_exe.c @@ -537,13 +537,14 @@ _efl_exe_efl_task_run(Eo *obj, Efl_Exe_Data *pd) { // hide stdin devnull = open("/dev/null", O_RDONLY); - dup2(devnull, STDIN_FILENO); + if (devnull < 0) _exit(1); + if (dup2(devnull, STDIN_FILENO) < 0) _exit(1); close(devnull); } else if ((td->flags & EFL_TASK_FLAGS_USE_STDIN)) { // hook up stdin to the pipe going to the parent - dup2(pipe_stdin[0], STDIN_FILENO); + if (dup2(pipe_stdin[0], STDIN_FILENO) < 0) _exit(1); close(pipe_stdin[0]); } @@ -552,13 +553,14 @@ _efl_exe_efl_task_run(Eo *obj, Efl_Exe_Data *pd) { // hide stdout devnull = open("/dev/null", O_WRONLY); - dup2(devnull, STDOUT_FILENO); + if (devnull < 0) _exit(1); + if (dup2(devnull, STDOUT_FILENO) < 0) _exit(1); close(devnull); } else if ((td->flags & EFL_TASK_FLAGS_USE_STDOUT)) { // hook up stdout to the pipe going to the parent - dup2(pipe_stdout[1], STDOUT_FILENO); + if (dup2(pipe_stdout[1], STDOUT_FILENO) < 0) _exit(1); close(pipe_stdout[1]); } @@ -566,7 +568,8 @@ _efl_exe_efl_task_run(Eo *obj, Efl_Exe_Data *pd) { // hide stderr devnull = open("/dev/null", O_WRONLY); - dup2(devnull, STDERR_FILENO); + if (devnull < 0) _exit(1); + if (dup2(devnull, STDERR_FILENO) < 0) _exit(1); close(devnull); } -- 2.7.4