diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-04-20 13:31:34 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-04-20 13:31:34 +0100 |
| commit | 66a40a37cda74dfc59690cd8897ef21403cc9817 (patch) | |
| tree | 94614994319890c65124f9cc575ed7be1683a9bb /src | |
| parent | c82b5bd0160a5e75293c2c15f5330f4dca5a6874 (diff) | |
prompt: zero password memory after running the command to be slightly more secure
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.cc | 4 |
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>(""); + } }); } }; |
