diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-10 16:16:51 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-13 23:37:32 +0100 |
commit | d4cb6456ea1f5e7ba75db5da3fc9df0cee32df2b (patch) | |
tree | 407109a3acb9300d698275d92c74092c8064f1f2 /drivers/serial | |
parent | 571ef4848a70285f0a82770cc7674b2ce78e7c19 (diff) | |
download | barebox-d4cb6456ea1f5e7ba75db5da3fc9df0cee32df2b.tar.gz barebox-d4cb6456ea1f5e7ba75db5da3fc9df0cee32df2b.tar.xz |
efi-stdio: limit set_cursor to screen size boundaries
set_cursor_position() may only be called with values actually inside the
screen. Limit the values accordingly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/efi-stdio.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c index 916354404b..1846469ea9 100644 --- a/drivers/serial/efi-stdio.c +++ b/drivers/serial/efi-stdio.c @@ -203,8 +203,11 @@ static int efi_process_square_bracket(struct efi_console_priv *priv, const char } break; case 'H': - if (arg0 >= 0 && arg1 >= 0) - priv->out->set_cursor_position(priv->out, arg1 - 1, arg0 - 1); + if (arg0 >= 0 && arg1 >= 0) { + int row = min_t(int, arg0, priv->rows); + int col = min_t(int, arg1, priv->columns); + priv->out->set_cursor_position(priv->out, col - 1, row - 1); + } break; case 'm': switch (arg0) { |