2022-05-08 17:01:47 +00:00
|
|
|
#include <cstring>
|
2021-10-31 15:11:46 +00:00
|
|
|
#include <string_view>
|
|
|
|
#include <Common/clearPasswordFromCommandLine.h>
|
|
|
|
|
|
|
|
using namespace std::literals;
|
2020-06-14 19:23:05 +00:00
|
|
|
|
|
|
|
void clearPasswordFromCommandLine(int argc, char ** argv)
|
|
|
|
{
|
|
|
|
for (int arg = 1; arg < argc; ++arg)
|
|
|
|
{
|
2021-10-31 15:11:46 +00:00
|
|
|
if (arg + 1 < argc && argv[arg] == "--password"sv)
|
2020-06-14 19:23:05 +00:00
|
|
|
{
|
|
|
|
++arg;
|
|
|
|
memset(argv[arg], 0, strlen(argv[arg]));
|
|
|
|
}
|
|
|
|
else if (0 == strncmp(argv[arg], "--password=", strlen("--password=")))
|
|
|
|
{
|
|
|
|
memset(argv[arg] + strlen("--password="), 0, strlen(argv[arg]) - strlen("--password="));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|