diff --git a/src/internal.c b/src/internal.c index 0c8d8fa3..f04797fd 100644 --- a/src/internal.c +++ b/src/internal.c @@ -8944,7 +8944,7 @@ int wolfSSH_DoModes(const byte* modes, word32 modesSz, int fd) tcgetattr(fd, &term); - while (idx < modesSz && modes[idx] != WOLFSSH_TTY_OP_END + while (idx + TERMINAL_MODE_SZ <= modesSz && modes[idx] != WOLFSSH_TTY_OP_END && modes[idx] < WOLFSSH_TTY_INVALID) { ato32(modes + idx + 1, &arg);