]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix potential index out of bounds
authorJohan Mattsson <39247600+mjunix@users.noreply.github.com>
Sat, 12 Aug 2023 22:48:20 +0000 (00:48 +0200)
committerGitHub <noreply@github.com>
Sat, 12 Aug 2023 22:48:20 +0000 (00:48 +0200)
clvm_cmds.c

index 8ccc97fa630fd76b90a686fcacc568dc8e985d9c..1e204e58ef291dbd7249596a3d2987ac96599071 100644 (file)
@@ -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));
                }