From d1342ae2f6a888143f7424f956604616580701b8 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 12 Oct 2024 19:52:07 +0200 Subject: [PATCH] fixed buffer overflow --- src/libgame/text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.34.1