diff --git a/encfs/FileUtils.cpp b/encfs/FileUtils.cpp index 39a3b88..f50d007 100644 --- a/encfs/FileUtils.cpp +++ b/encfs/FileUtils.cpp @@ -1348,6 +1348,11 @@ CipherKey EncFSConfig::makeKey(const char *password, int passwdLen) { CipherKey userKey; std::shared_ptr cipher = getCipher(); + if (passwdLen == 0) { + cerr << _("fatal: zero-length passwords are not allowed\n"); + exit(1); + } + // if no salt is set and we're creating a new password for a new // FS type, then initialize salt.. if (salt.size() == 0 && kdfIterations == 0 && cfgType >= Config_V6) { @@ -1389,10 +1394,12 @@ CipherKey EncFSConfig::getUserKey(bool useStdin) { } CipherKey userKey; - if (!res) - cerr << _("Zero length password not allowed\n"); - else + if (!res) { + cerr << _("fatal: error reading password\n"); + exit(1); + } else { userKey = makeKey(passBuf, strlen(passBuf)); + } memset(passBuf, 0, sizeof(passBuf));