mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +03:00
Fix UTIL_ReplaceAll not properly tracking length.
This commit is contained in:
parent
1662b47f7e
commit
2099a88ddf
@ -459,11 +459,14 @@ unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search
|
||||
size_t searchLen = strlen(search);
|
||||
size_t replaceLen = strlen(replace);
|
||||
|
||||
char *ptr = subject;
|
||||
char *newptr, *ptr = subject;
|
||||
unsigned int total = 0;
|
||||
while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
|
||||
while ((newptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
|
||||
{
|
||||
total++;
|
||||
maxlength -= newptr - ptr;
|
||||
ptr = newptr;
|
||||
|
||||
if (*ptr == '\0')
|
||||
{
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user