FileDocCategorySizeDatePackage
CorruptString.javaAPI DocExample535Sat Jan 13 11:34:10 GMT 2001javasec.samples.ch03

CorruptString.java

package javasec.samples.ch03;

public class CorruptString {
    public static void modifyString(String src, String dst) {
        for (int i = 0; i < src.value.length; i++) {
            if (i == dst.value.length)
                return;
            src.value[i] = dst.value[i];
        }
    }

    public static void main(String[] args) {
        System.out.println("Original string is " + args[0]);
        modifyString(args[0], "SDO was here");
        System.out.println("Modified string is " + args[0]);
    }
}