afb-args: Use secure_getenv 57/20857/1
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 28 Mar 2019 17:59:55 +0000 (18:59 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 29 Mar 2019 13:12:52 +0000 (14:12 +0100)
Improves security of the binder by using
secure_getenv instead of getenv.

Change-Id: Iffd56ca65251763aacb0b9dbbaa768619cd92dd4
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-config.c

index 1cc84b0..87fad97 100644 (file)
@@ -969,7 +969,7 @@ void afb_config_dump(struct json_object *config)
 
 static void on_environment(struct json_object *config, int optid, const char *name, void (*func)(struct json_object*, int, const char*))
 {
-       char *value = getenv(name);
+       char *value = secure_getenv(name);
 
        if (value && *value)
                func(config, optid, value);
@@ -977,7 +977,7 @@ static void on_environment(struct json_object *config, int optid, const char *na
 
 static void on_environment_enum(struct json_object *config, int optid, const char *name, int (*func)(const char*))
 {
-       char *value = getenv(name);
+       char *value = secure_getenv(name);
 
        if (value) {
                if (func(value) == -1)
@@ -989,7 +989,7 @@ static void on_environment_enum(struct json_object *config, int optid, const cha
 
 static void on_environment_bool(struct json_object *config, int optid, const char *name)
 {
-       char *value = getenv(name);
+       char *value = secure_getenv(name);
        int asbool;
 
        if (value) {