diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c
index 56b7e981399baaaac50c43946eb3109d317d26ad..0267b20e9165fa6c0238fa5da4fbd5e4a80b1d2d 100644
--- a/src/uifc/uifc32.c
+++ b/src/uifc/uifc32.c
@@ -2692,8 +2692,8 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
 	if(api->mode&UIFC_MOUSE)
 		title_len+=6;
 
-	if((unsigned)(top+height)>api->scrn_len-3)
-		height=(api->scrn_len-3)-top;
+	if((unsigned)(top+height)>=api->scrn_len)
+		height = api->scrn_len - top;
 	if(!width || (unsigned)width<title_len+6)
 		width=title_len+6;
 	if((unsigned)width>api->scrn_width)