From 4e57309dc096379a27ea8da7c77469bf7e9b673e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 12 Oct 2024 21:13:56 +0200 Subject: [PATCH] fixed potential buffer overflow --- src/libgame/text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libgame/text.c b/src/libgame/text.c index 04893897..2d2d43e0 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -554,8 +554,8 @@ static void setTextBufferCharSize(int *line_length, int *cut_length, int *max_li int font_height = getFontHeight(font_nr); int line_height = font_height + line_spacing; - *line_length = line_width / font_width; - *cut_length = cut_width / font_width; + *line_length = MIN(line_width / font_width, MAX_OUTPUT_LINESIZE); + *cut_length = MIN(cut_width / font_width, MAX_OUTPUT_LINESIZE); *max_lines = max_height / line_height; } -- 2.34.1