From 6715d712c4b7e2d1366359a99c8a6cbfa50f6262 Mon Sep 17 00:00:00 2001 From: Johan Mattsson <39247600+mjunix@users.noreply.github.com> Date: Sun, 13 Aug 2023 00:49:42 +0200 Subject: [PATCH] Fix potential index out of bounds --- gl_draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gl_draw.c b/gl_draw.c index b4978abb..fd9adfa1 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -592,7 +592,7 @@ static void LoadFont_f(cmd_state_t *cmd) c = cm; } - if(!c || (c - filelist) > MAX_QPATH) + if(!c || (c - filelist) >= MAX_QPATH) strlcpy(mainfont, filelist, sizeof(mainfont)); else { @@ -617,7 +617,7 @@ static void LoadFont_f(cmd_state_t *cmd) f->fallback_faces[i] = 0; // f->req_face; could make it stick to the default-font's face index c = cm; } - if(!c || (c-filelist) > MAX_QPATH) + if(!c || (c-filelist) >= MAX_QPATH) { strlcpy(f->fallbacks[i], filelist, sizeof(mainfont)); } -- 2.39.2