diff --git a/Misc/Util.cs b/Misc/Util.cs index 97016e2..9e05f03 100644 --- a/Misc/Util.cs +++ b/Misc/Util.cs @@ -91,8 +91,8 @@ internal static void ReplaceAllBytes(byte[] array, byte[] oldPattern, byte[] new { if (oldPattern.Length != newPattern.Length || oldPattern.SequenceEqual(newPattern)) return; - int offset; // Loop until no instances of oldPattern are found - while ((offset = IndexOfBytes(array, oldPattern, 0, 0)) != -1) + int offset = 0; // Loop until no instances of oldPattern are found + while ((offset = IndexOfBytes(array, oldPattern, offset, 0)) != -1) Array.Copy(newPattern, 0, array, offset, newPattern.Length); } }