q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=95d414549b9e6838b7b2d59e105ddf6955aa8d97

commit 95d414549b9e6838b7b2d59e105ddf6955aa8d97
Author: Daniel Kolesa <[email protected]>
Date:   Thu Feb 21 15:04:31 2019 +0100

    tests: add chdir in elua to prevent incorrect file accesses
    
    Elua is testing API that tries to read files by path, prevent
    unintentional reads from current working directory by changing
    that directory.
---
 src/tests/elua/elua_lib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/tests/elua/elua_lib.c b/src/tests/elua/elua_lib.c
index 4f53e7d869..bcf1b26f90 100644
--- a/src/tests/elua/elua_lib.c
+++ b/src/tests/elua/elua_lib.c
@@ -4,6 +4,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include <Eina.h>
 #include <Elua.h>
@@ -28,6 +29,11 @@ EFL_START_TEST(elua_api)
     st = elua_state_new("test");
     fail_if(!st);
 
+    /* elua APIs here try accessing files by relative path,
+     * prevent any unintentional file accesses in cwd
+     */
+    fail_if(chdir(TESTS_SRC_DIR));
+
     /* test env vars */
     setenv("ELUA_CORE_DIR", "foo", 1);
     setenv("ELUA_MODULES_DIR", "bar", 1);

-- 


Reply via email to