From 9cf93111d65af68225c551b33a37a2516ce6b51b Mon Sep 17 00:00:00 2001 From: Bernhard Date: Tue, 1 Sep 2020 12:29:21 +0200 Subject: [PATCH] Fix heap-use-after-free & error-msg output in keepassxc-cli * Fixes #5367 --- src/cli/keepassxc-cli.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cli/keepassxc-cli.cpp b/src/cli/keepassxc-cli.cpp index a9b276fda..5d326f46e 100644 --- a/src/cli/keepassxc-cli.cpp +++ b/src/cli/keepassxc-cli.cpp @@ -158,7 +158,7 @@ void enterInteractiveMode(const QStringList& arguments) auto cmd = Commands::getCommand(args[0]); if (!cmd) { - err << QObject::tr("Unknown command %1").arg(args[0]) << "\n"; + err << QObject::tr("Unknown command %1").arg(args[0]) << endl; continue; } else if (cmd->name == "quit" || cmd->name == "exit") { break; @@ -167,6 +167,7 @@ void enterInteractiveMode(const QStringList& arguments) cmd->currentDatabase = currentDatabase; cmd->execute(args); currentDatabase = cmd->currentDatabase; + cmd->currentDatabase.reset(); } if (currentDatabase) {