summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor V. Kovalenko <igor.v.kovalenko@gmail.com>2023-11-12 15:40:15 +0300
committerIgor V. Kovalenko <igor.v.kovalenko@gmail.com>2023-11-12 15:53:38 +0300
commit81a6cc4967d1f19cef800932b10ade7f896ee2ea (patch)
tree331783d13b5aa07483b4377f2f45147b7b708288
parent06ccfbb996e5b8b31f04f97795e8c9f083bea332 (diff)
Fix crash running in restricted environment.
When `pwd.h` header is not available (i.e. not using glibc) and environment variables are not set (e.g. running via `env --ignore-environment`) client library would crash due to uninitialized variable in `pa_get_home_dir()`. Add missing initialization to fix that. Fixes: #3792 Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/800>
-rw-r--r--src/pulse/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pulse/util.c b/src/pulse/util.c
index 5933b77e8..c7b828cc2 100644
--- a/src/pulse/util.c
+++ b/src/pulse/util.c
@@ -167,7 +167,7 @@ char *pa_get_host_name(char *s, size_t l) {
char *pa_get_home_dir(char *s, size_t l) {
char *e;
- char *dir;
+ char *dir = NULL;
#ifdef HAVE_PWD_H
struct passwd *r;
#endif