Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,16 +1096,22 @@ static int WS_TermResize(WOLFSSH* ssh, word32 col, word32 row, word32 colP,
int ret = WS_SUCCESS;

if (term != NULL) {
char cmd[20];
int cmdSz = 20;
char cmd[30]; /* 2 int values (11 chars max) plus \x1b[8 ; t */
int cmdSz;
DWORD wrtn = 0;

cmdSz = (int)sizeof(cmd);
/* VT control sequence for resizing window */
cmdSz = snprintf(cmd, cmdSz, "\x1b[8;%d;%dt", row, col);
if (WriteFile(*term, cmd, cmdSz, &wrtn, 0) != TRUE) {
WLOG(WS_LOG_ERROR, "Issue with pseudo console resize");
if (cmdSz < 0 || cmdSz >= sizeof(cmd)) {
ret = WS_FATAL_ERROR;
}
else {
if (WriteFile(*term, cmd, cmdSz, &wrtn, 0) != TRUE) {
WLOG(WS_LOG_ERROR, "Issue with pseudo console resize");
ret = WS_FATAL_ERROR;
}
}
}

return ret;
Expand Down