fixed some crashes

This commit is contained in:
mq1n
2025-09-22 11:25:58 +03:00
parent bdcb68619a
commit 51ee5feb78
5 changed files with 27 additions and 16 deletions

View File

@@ -71,7 +71,7 @@ void string_replace_word(const char* base, int base_len, const char* src, int sr
int cur = 0;
while (cur < base_len)
{
if (memcmp(base + cur, src, src_len) == 0)
if (cur + src_len <= base_len && memcmp(base + cur, src, src_len) == 0)
{
result.append(base + prev, cur - prev);
result.append(dst, dst_len);