summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/core-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-08-06 03:04:22 +0200
committerLennart Poettering <lennart@poettering.net>2008-08-06 03:04:22 +0200
commit9fde00e449f2892f67f4cf2f7f7bf66f014f08a0 (patch)
tree699c4c64ceb0e40cb13ef502fc34c890a4c073e1 /src/pulsecore/core-util.c
parent34dd4a20f2e976b260e8aa3f3128e55ec80bb85b (diff)
fix a few potential bad memory accesses
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r--src/pulsecore/core-util.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index c4818e39..7c1534ae 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1185,7 +1185,7 @@ static char *get_dir(mode_t m, const char *env_name) {
}
if (st.st_uid != getuid()) {
- pa_log_error("Home directory %s not ours.", d);
+ pa_log_error("Home directory %s not ours.", h);
return NULL;
}
@@ -1253,6 +1253,8 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", e, local);
else if (pa_get_home_dir(h, sizeof(h)))
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse" PA_PATH_SEP "%s", h, local);
+ else
+ return NULL;
#ifdef OS_IS_WIN32
if (!ExpandEnvironmentStrings(lfn, buf, PATH_MAX)) {
@@ -1311,6 +1313,7 @@ char *pa_find_config_file(const char *global, const char *local, const char *env
#endif
if (env && (fn = getenv(env))) {
+
#ifdef OS_IS_WIN32
if (!ExpandEnvironmentStrings(fn, buf, PATH_MAX))
return NULL;
@@ -1333,6 +1336,8 @@ char *pa_find_config_file(const char *global, const char *local, const char *env
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", e, local);
else if (pa_get_home_dir(h, sizeof(h)))
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse" PA_PATH_SEP "%s", h, local);
+ else
+ return NULL;
#ifdef OS_IS_WIN32
if (!ExpandEnvironmentStrings(lfn, buf, PATH_MAX)) {
@@ -1364,7 +1369,7 @@ char *pa_find_config_file(const char *global, const char *local, const char *env
global = buf;
#endif
- if (access(fn, R_OK) == 0)
+ if (access(global, R_OK) == 0)
return pa_xstrdup(global);
} else
errno = ENOENT;