From: Johan Mattsson <39247600+mjunix@users.noreply.github.com> Date: Sat, 12 Aug 2023 22:48:20 +0000 (+0200) Subject: Fix potential index out of bounds X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=64994e79e2d208fbfbe9939457777b50fa3d368e;p=xonotic%2Fdarkplaces.git Fix potential index out of bounds --- diff --git a/clvm_cmds.c b/clvm_cmds.c index 8ccc97fa..1e204e58 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1663,7 +1663,7 @@ void VM_loadfont(prvm_prog_t *prog) f->req_face = 0; c = cm; } - if(!c || (c - filelist) > MAX_QPATH) + if(!c || (c - filelist) >= MAX_QPATH) strlcpy(mainfont, filelist, sizeof(mainfont)); else { @@ -1689,7 +1689,7 @@ void VM_loadfont(prvm_prog_t *prog) 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)); }