From c3d5740e983891b18bd45fccf45ac89cd9345403 Mon Sep 17 00:00:00 2001
From: SwitchKaze <azeonus@gmail.com>
Date: Tue, 6 Apr 2021 15:06:44 -0500
Subject: [PATCH] Fix console text bleeding edge case

A single character could prematurely read if there were enough special characters to push 'c' past 'con_width'.
---
 src/console.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/console.c b/src/console.c
index 2d95e10b8b..208b552122 100644
--- a/src/console.c
+++ b/src/console.c
@@ -1654,6 +1654,8 @@ static void CON_DrawHudlines(void)
 				p++;
 				c++;
 			}
+			if (c >= con_width)
+				break;
 			if (*p < HU_FONTSTART)
 				;//charwidth = 4 * con_scalefactor;
 			else
@@ -1777,6 +1779,8 @@ static void CON_DrawConsole(void)
 				p++;
 				c++;
 			}
+			if (c >= con_width)
+				break;
 			V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true);
 		}
 	}
-- 
GitLab