From: Holger Schemel Date: Sat, 12 Oct 2024 17:52:07 +0000 (+0200) Subject: fixed buffer overflow X-Git-Tag: 4.4.0.0-test-4~137 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d1342ae2f6a888143f7424f956604616580701b8;p=rocksndiamonds.git fixed buffer overflow --- diff --git a/src/libgame/text.c b/src/libgame/text.c index 87cd7dc2..04893897 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -534,7 +534,7 @@ static void DrawTextBuffer_Flush(int x, int y, char *buffer, int line_width = font_width * line_length; int buffer_width = font_width * buffer_len; int offset_xsize = (centered ? (line_width - buffer_width) / 2 : 0); - int final_cut_length = MAX(0, cut_length - offset_chars); + int final_cut_length = MIN(MAX(0, cut_length - offset_chars), buffer_len); int xx = x + offset_xsize; int yy = y + current_ypos;