]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
i'm sure there are plenty of bugs here for you guys to fix
authorsajt <sajt@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 9 Oct 2007 19:50:26 +0000 (19:50 +0000)
committersajt <sajt@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 9 Oct 2007 19:50:26 +0000 (19:50 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7616 d7cf8633-e32d-0410-b094-e92efae38249

prvm_cmds.c

index 6276252c0f50d46d6e26786e75a896968b027956..abb553a581cd7f95a137ac7b05b692f5076d2ab1 100644 (file)
@@ -1905,7 +1905,7 @@ void VM_strreplace(void)
                for (j = 0; j < search_len && i+j < subject_len; j++)
                        if (subject[i+j] != search[j])
                                break;
-               if (j == search_len)
+               if (j == search_len || i+j == subject_len)
                {
                // found it at offset 'i'
                        for (j = 0; j < replace_len && si < (int)sizeof(string) - 1; j++)
@@ -1954,7 +1954,7 @@ void VM_strireplace(void)
                for (j = 0; j < search_len && i+j < subject_len; j++)
                        if (tolower(subject[i+j]) != tolower(search[j]))
                                break;
-               if (j == search_len)
+               if (j == search_len || i+j == subject_len)
                {
                // found it at offset 'i'
                        for (j = 0; j < replace_len && si < (int)sizeof(string) - 1; j++)