From 2942e1d5fa49af36df6611b9d43f819d2de95ee5 Mon Sep 17 00:00:00 2001 From: sajt Date: Tue, 9 Oct 2007 19:50:26 +0000 Subject: [PATCH] i'm sure there are plenty of bugs here for you guys to fix git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7616 d7cf8633-e32d-0410-b094-e92efae38249 --- prvm_cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prvm_cmds.c b/prvm_cmds.c index 6276252c..abb553a5 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -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++) -- 2.39.2