From 64994e79e2d208fbfbe9939457777b50fa3d368e Mon Sep 17 00:00:00 2001 From: Johan Mattsson <39247600+mjunix@users.noreply.github.com> Date: Sun, 13 Aug 2023 00:48:20 +0200 Subject: [PATCH] Fix potential index out of bounds --- clvm_cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)); } -- 2.39.2