jDoc + code cleanup
[nikiroo-utils.git] / src / be / nikiroo / utils / ReplaceInputStream.java
index ff2ec88ef6581f51905c4afe53c8453098e79e1a..a456463b79032585a1c6372656265c4f089495c6 100644 (file)
@@ -69,7 +69,7 @@ public class ReplaceInputStream extends BufferedInputStream {
                // Note: very simple, not efficient implementation, sorry.
                int count = 0;
                while (spos < slen && count < buffer.length - to.length) {
-                       if (from.length > 0 && startsWith(from, source, spos)) {
+                       if (from.length > 0 && startsWith(from, source, spos, slen)) {
                                System.arraycopy(to, 0, buffer, spos, to.length);
                                count += to.length;
                                spos += from.length;