From: Holger Schemel Date: Sat, 12 Oct 2024 19:13:56 +0000 (+0200) Subject: fixed potential buffer overflow X-Git-Tag: 4.4.0.0-test-4~136 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4e57309dc096379a27ea8da7c77469bf7e9b673e;p=rocksndiamonds.git fixed potential buffer overflow --- 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; }