Simplify code to wipe out the command-line args.
This commit is contained in:
parent
25a5a92b47
commit
79d66e4484
@ -52,28 +52,10 @@
|
||||
// ==========================================================================
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _DLL
|
||||
#define _acmdln GetCommandLineA()
|
||||
#define _wcmdln GetCommandLineW()
|
||||
#else
|
||||
extern char *const _acmdln;
|
||||
extern wchar_t *const _wcmdln;
|
||||
#endif
|
||||
static void clear_cmdline_args(char *const acmdln, wchar_t *const wcmdln)
|
||||
{
|
||||
if (acmdln && acmdln[0U])
|
||||
{
|
||||
const size_t len = strlen(acmdln);
|
||||
slunkcrypt_bzero(acmdln, len * sizeof(char));
|
||||
if (len > 5U) strcpy(acmdln, "slunk");
|
||||
}
|
||||
if (wcmdln && wcmdln[0U])
|
||||
{
|
||||
const size_t len = wcslen(wcmdln);
|
||||
slunkcrypt_bzero(wcmdln, len * sizeof(wchar_t));
|
||||
if (len > 5U) wcscpy(wcmdln, L"slunk");
|
||||
}
|
||||
}
|
||||
_CRTIMP char **__cdecl __p__acmdln(void);
|
||||
_CRTIMP wchar_t **__cdecl __p__wcmdln(void);
|
||||
#define _acmdln (*__p__acmdln())
|
||||
#define _wcmdln (*__p__wcmdln())
|
||||
#endif
|
||||
|
||||
void init_terminal(void)
|
||||
@ -82,7 +64,8 @@ void init_terminal(void)
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||
_setmode(_fileno(stderr), _O_U8TEXT);
|
||||
_setmode(_fileno(stdin), _O_BINARY);
|
||||
clear_cmdline_args(_acmdln, _wcmdln);
|
||||
slunkcrypt_bzero(_acmdln, strlen(_acmdln) * sizeof(char));
|
||||
slunkcrypt_bzero(_wcmdln, wcslen(_wcmdln) * sizeof(wchar_t));
|
||||
#else
|
||||
openlog("slunkcrypt", LOG_PID | LOG_CONS, LOG_USER);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user