]> 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:49:42 +0000 (00:49 +0200)
committerGitHub <noreply@github.com>
Sat, 12 Aug 2023 22:49:42 +0000 (00:49 +0200)
gl_draw.c

index b4978abb1e4715a803a8eaae17b452c569705e4a..fd9adfa152b65fd80f59b0cc35c30325009fa23d 100644 (file)
--- 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));
                }