1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-10-05 07:33:51 +03:00

Remove all direct use of getenv

Unconditional use of getenv is not secure in setuid env.
While not all libvirt code runs in a setuid env (since
much of it only exists inside libvirtd) this is not always
clear to developers. So make all the code paranoid, even
if it only ever runs inside libvirtd.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange
2013-10-09 11:18:15 +01:00
parent 9b8f307c6a
commit 1e4a02bdfe
17 changed files with 41 additions and 37 deletions

View File

@@ -991,7 +991,7 @@ static int migrateProfile(void)
goto cleanup;
}
config_home = getenv("XDG_CONFIG_HOME");
config_home = virGetEnvBlockSUID("XDG_CONFIG_HOME");
if (config_home && config_home[0] != '\0') {
if (VIR_STRDUP(xdg_dir, config_home) < 0)
goto cleanup;