mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-05 16:22:36 -08:00
Fix freeze and high CPU usage on invalid STDIN data, resolves #1620
This commit is contained in:
1 parent
386b78b896
commit
63a17f697c
3 files changed
+41
-23
No files matched your search
+8
-5
@@ -143,12 +143,15 @@ int main(int argc, char** argv)
|
||||
|
||||
const bool pwstdin = parser.isSet(pwstdinOption);
|
||||
for (const QString& filename: fileNames) {
|
||||
QString password;
|
||||
if (pwstdin) {
|
||||
// we always need consume a line of STDIN if --pw-stdin is set to clear out the
|
||||
// buffer for native messaging, even if the specified file does not exist
|
||||
static QTextStream in(stdin, QIODevice::ReadOnly);
|
||||
password = in.readLine();
|
||||
}
|
||||
|
||||
if (!filename.isEmpty() && QFile::exists(filename) && !filename.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
QString password;
|
||||
if (pwstdin) {
|
||||
static QTextStream in(stdin, QIODevice::ReadOnly);
|
||||
password = in.readLine();
|
||||
}
|
||||
mainWindow.openDatabase(filename, password, parser.value(keyfileOption));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user