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 _WIN32
|
||||||
#ifdef _DLL
|
_CRTIMP char **__cdecl __p__acmdln(void);
|
||||||
#define _acmdln GetCommandLineA()
|
_CRTIMP wchar_t **__cdecl __p__wcmdln(void);
|
||||||
#define _wcmdln GetCommandLineW()
|
#define _acmdln (*__p__acmdln())
|
||||||
#else
|
#define _wcmdln (*__p__wcmdln())
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void init_terminal(void)
|
void init_terminal(void)
|
||||||
@ -82,7 +64,8 @@ void init_terminal(void)
|
|||||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||||
_setmode(_fileno(stderr), _O_U8TEXT);
|
_setmode(_fileno(stderr), _O_U8TEXT);
|
||||||
_setmode(_fileno(stdin), _O_BINARY);
|
_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
|
#else
|
||||||
openlog("slunkcrypt", LOG_PID | LOG_CONS, LOG_USER);
|
openlog("slunkcrypt", LOG_PID | LOG_CONS, LOG_USER);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user