]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix a size_t comparison warning by doing the math better.
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 24 May 2020 07:03:22 +0000 (07:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 24 May 2020 07:03:22 +0000 (07:03 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12560 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c

diff --git a/cmd.c b/cmd.c
index fedfb13dcbe52b86dfd7eaf0a2fcf8b7fe795ec7..ce0c4013b26c9cb9bc7ae78f53e06e2d7941c0e0 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -196,7 +196,7 @@ void Cbuf_AddText (cmd_state_t *cmd, const char *text)
        l = (int)strlen(text);
 
        Cbuf_Lock(cmd);
-       if (cmd->text.cursize + l >= (size_t)cmd->text.maxsize)
+       if (cmd->text.maxsize - cmd->text.cursize <= l)
                Con_Print("Cbuf_AddText: overflow\n");
        else
                SZ_Write(&cmd->text, (const unsigned char *)text, l);