diff options
author | 2015-10-08 21:44:38 -0500 | |
---|---|---|
committer | 2015-12-11 15:02:36 +0800 | |
commit | b4b5c2188f9d574b8ddb05355d030f530b165cb2 (patch) | |
tree | 42ae906fe8d3a794d496272f2384cf2b5c5bea0a /src | |
parent | a0eef2663a6871673d3d9a9535fde704bd92c952 (diff) |
Check that $XDG_RUNTIME_DIR is valid and accessible
Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
Diffstat (limited to 'src')
-rw-r--r-- | src/env_universal_common.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/env_universal_common.cpp b/src/env_universal_common.cpp index d5d14378..c67fa415 100644 --- a/src/env_universal_common.cpp +++ b/src/env_universal_common.cpp @@ -147,7 +147,12 @@ static wcstring get_runtime_path() { wcstring result; const char *dir = getenv("XDG_RUNTIME_DIR"); - if (dir != NULL) + + // Check that the path is actually usable + // Technically this is guaranteed by the fdo spec but in practice + // it is not always the case: see #1828 and #2222 + int mode = R_OK | W_OK | X_OK; + if (dir != NULL && access(dir, mode) == 0 && check_runtime_path(dir) == 0) { result = str2wcstring(dir); } |