summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-04-20 13:31:34 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-04-20 13:31:34 +0100
commit66a40a37cda74dfc59690cd8897ef21403cc9817 (patch)
tree94614994319890c65124f9cc575ed7be1683a9bb /src
parentc82b5bd0160a5e75293c2c15f5330f4dca5a6874 (diff)
prompt: zero password memory after running the command to be slightly more secure
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 3ddfcc3a..119aa0fe 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -1585,7 +1585,11 @@ const CommandDesc prompt_cmd = {
CommandManager::instance().execute(command, context, shell_context);
if (password)
+ {
+ const String& str = RegisterManager::instance()[reg].values(context)[0];
+ memset(const_cast<String&>(str).data(), 0, (int)str.length());
RegisterManager::instance()[reg] = ConstArrayView<String>("");
+ }
});
}
};