diff --git a/ChangeLog.txt b/ChangeLog.txt index 04793bf7..bfa5772e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -38,6 +38,7 @@ Fixed bugs: * Fixed determining the user's homedir: If $HOME and the /etc/passwd entry for the current user contradict each other, now $HOME takes preference over /etc/passwd. * Fix Android compilation, https://github.com/cryfs/cryfs/issues/345 * Remove cryfs-stats tool which isn't ready yet and could destroy the file system +* Fixed crash on startup when running in an environment that doesn't have $HOME set (e.g. an empty env), https://github.com/cryfs/cryfs/issues/374 Version 0.10.2 diff --git a/src/cpp-utils/system/homedir.cpp b/src/cpp-utils/system/homedir.cpp index 4b64090d..07b670a5 100644 --- a/src/cpp-utils/system/homedir.cpp +++ b/src/cpp-utils/system/homedir.cpp @@ -9,7 +9,8 @@ using std::string; #include namespace { bf::path _get_home_directory() { - string homedir = getenv("HOME"); + const char* homedir_ = getenv("HOME"); + string homedir = (homedir_ == nullptr) ? "" : homedir_; if (homedir == "") { // try the /etc/passwd entry struct passwd* pwd = getpwuid(getuid());