Fix crash due to negative max copy length.