diff --git a/gnu/lib/libdialog/checklist.c b/gnu/lib/libdialog/checklist.c index 61a636be3c25..c31a9305903c 100644 --- a/gnu/lib/libdialog/checklist.c +++ b/gnu/lib/libdialog/checklist.c @@ -70,6 +70,10 @@ int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, in width = MAX(width,check_x+4)+4; } + if (width > COLS) + width = COLS; + if (height > LINES) + height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; diff --git a/gnu/lib/libdialog/inputbox.c b/gnu/lib/libdialog/inputbox.c index 3e5895d3e0ab..61dd2f21248f 100644 --- a/gnu/lib/libdialog/inputbox.c +++ b/gnu/lib/libdialog/inputbox.c @@ -41,6 +41,10 @@ int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int width = MAX(i,j) + 4; } + if (width > COLS) + width = COLS; + if (height > LINES) + height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; diff --git a/gnu/lib/libdialog/menubox.c b/gnu/lib/libdialog/menubox.c index fdb9f05116fc..ed82ae5670bc 100644 --- a/gnu/lib/libdialog/menubox.c +++ b/gnu/lib/libdialog/menubox.c @@ -60,6 +60,10 @@ int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int wid width = MAX(width,tag_x+4)+4; } + if (width > COLS) + width = COLS; + if (height > LINES) + height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; diff --git a/gnu/lib/libdialog/msgbox.c b/gnu/lib/libdialog/msgbox.c index fda3b40641a9..50f6c13b2057 100644 --- a/gnu/lib/libdialog/msgbox.c +++ b/gnu/lib/libdialog/msgbox.c @@ -40,6 +40,10 @@ int dialog_msgbox(unsigned char *title, unsigned char *prompt, int height, int w width = MAX(i,j)+4; } + if (width > COLS) + width = COLS; + if (height > LINES) + height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; diff --git a/gnu/lib/libdialog/prgbox.c b/gnu/lib/libdialog/prgbox.c index 0145389d4000..53275bfd704e 100644 --- a/gnu/lib/libdialog/prgbox.c +++ b/gnu/lib/libdialog/prgbox.c @@ -39,6 +39,10 @@ int dialog_prgbox(unsigned char *title, const unsigned char *line, int height, i fprintf(stderr, "\nAutosizing is impossible in dialog_prgbox().\n"); exit(-1); } + if (width > COLS) + width = COLS; + if (height > LINES) + height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; diff --git a/gnu/lib/libdialog/radiolist.c b/gnu/lib/libdialog/radiolist.c index 54fce3896fbb..5b8a68fff56d 100644 --- a/gnu/lib/libdialog/radiolist.c +++ b/gnu/lib/libdialog/radiolist.c @@ -78,6 +78,10 @@ int dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, in width = MAX(width,check_x+4)+4; } + if (width > COLS) + width = COLS; + if (height > LINES) + height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; diff --git a/gnu/lib/libdialog/textbox.c b/gnu/lib/libdialog/textbox.c index 099f98ef0e72..0479723e41b6 100644 --- a/gnu/lib/libdialog/textbox.c +++ b/gnu/lib/libdialog/textbox.c @@ -89,6 +89,10 @@ int dialog_textbox(unsigned char *title, unsigned char *file, int height, int wi buf[bytes_read] = '\0'; /* mark end of valid data */ page = buf; /* page is pointer to start of page to be displayed */ + if (width > COLS) + width = COLS; + if (height > LINES) + height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2; diff --git a/gnu/lib/libdialog/yesno.c b/gnu/lib/libdialog/yesno.c index 1e4f77db4b12..8d253608e6bb 100644 --- a/gnu/lib/libdialog/yesno.c +++ b/gnu/lib/libdialog/yesno.c @@ -39,6 +39,10 @@ int dialog_yesno(unsigned char *title, unsigned char * prompt, int height, int w width = MAX(i,j)+4; } + if (width > COLS) + width = COLS; + if (height > LINES) + height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; y = (LINES - height)/2;