GUACAMOLE-610: Limit terminal width/height to 1024 characters.
This commit is contained in:
parent
0062f61d67
commit
6a576f0121
@ -590,13 +590,29 @@ guac_terminal* guac_terminal_create(guac_client* client,
|
|||||||
term->default_char = default_char;
|
term->default_char = default_char;
|
||||||
term->clipboard = clipboard;
|
term->clipboard = clipboard;
|
||||||
|
|
||||||
|
/* Calculate character size */
|
||||||
|
int rows = height / term->display->char_height;
|
||||||
|
int columns = available_width / term->display->char_width;
|
||||||
|
|
||||||
|
/* Keep height within predefined maximum */
|
||||||
|
if (rows > GUAC_TERMINAL_MAX_ROWS) {
|
||||||
|
rows = GUAC_TERMINAL_MAX_ROWS;
|
||||||
|
height = rows * term->display->char_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep width within predefined maximum */
|
||||||
|
if (columns > GUAC_TERMINAL_MAX_COLUMNS) {
|
||||||
|
columns = GUAC_TERMINAL_MAX_COLUMNS;
|
||||||
|
available_width = columns * term->display->char_width;
|
||||||
|
width = available_width + GUAC_TERMINAL_SCROLLBAR_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set pixel size */
|
/* Set pixel size */
|
||||||
term->width = width;
|
term->width = width;
|
||||||
term->height = height;
|
term->height = height;
|
||||||
|
|
||||||
/* Calculate character size */
|
term->term_width = columns;
|
||||||
term->term_width = available_width / term->display->char_width;
|
term->term_height = rows;
|
||||||
term->term_height = height / term->display->char_height;
|
|
||||||
|
|
||||||
/* Open STDIN pipe */
|
/* Open STDIN pipe */
|
||||||
if (pipe(term->stdin_pipe_fd)) {
|
if (pipe(term->stdin_pipe_fd)) {
|
||||||
@ -1508,6 +1524,19 @@ int guac_terminal_resize(guac_terminal* terminal, int width, int height) {
|
|||||||
int rows = height / display->char_height;
|
int rows = height / display->char_height;
|
||||||
int columns = available_width / display->char_width;
|
int columns = available_width / display->char_width;
|
||||||
|
|
||||||
|
/* Keep height within predefined maximum */
|
||||||
|
if (rows > GUAC_TERMINAL_MAX_ROWS) {
|
||||||
|
rows = GUAC_TERMINAL_MAX_ROWS;
|
||||||
|
height = rows * display->char_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep width within predefined maximum */
|
||||||
|
if (columns > GUAC_TERMINAL_MAX_COLUMNS) {
|
||||||
|
columns = GUAC_TERMINAL_MAX_COLUMNS;
|
||||||
|
available_width = columns * display->char_width;
|
||||||
|
width = available_width + GUAC_TERMINAL_SCROLLBAR_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set pixel sizes */
|
/* Set pixel sizes */
|
||||||
terminal->width = width;
|
terminal->width = width;
|
||||||
terminal->height = height;
|
terminal->height = height;
|
||||||
|
@ -37,6 +37,17 @@
|
|||||||
#include <guacamole/client.h>
|
#include <guacamole/client.h>
|
||||||
#include <guacamole/stream.h>
|
#include <guacamole/stream.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The absolute maximum number of rows to allow within the display.
|
||||||
|
*/
|
||||||
|
#define GUAC_TERMINAL_MAX_ROWS 1024
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The absolute maximum number of columns to allow within the display. This
|
||||||
|
* implicitly limits the number of columns allowed within the buffer.
|
||||||
|
*/
|
||||||
|
#define GUAC_TERMINAL_MAX_COLUMNS 1024
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum duration of a single frame, in milliseconds.
|
* The maximum duration of a single frame, in milliseconds.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user