prompt: zero password memory after running the command to be slightly more secure

This commit is contained in:
Maxime Coste 2016-04-20 13:31:34 +01:00
parent c82b5bd016
commit 66a40a37cd

View File

@ -1585,7 +1585,11 @@ const CommandDesc prompt_cmd = {
CommandManager::instance().execute(command, context, shell_context); CommandManager::instance().execute(command, context, shell_context);
if (password) 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>(""); RegisterManager::instance()[reg] = ConstArrayView<String>("");
}
}); });
} }
}; };