From: Johan Mattsson <39247600+mjunix@users.noreply.github.com> Date: Sat, 12 Aug 2023 22:49:42 +0000 (+0200) Subject: Fix potential index out of bounds X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6715d712c4b7e2d1366359a99c8a6cbfa50f6262;p=xonotic%2Fdarkplaces.git Fix potential index out of bounds --- 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)); }