Commit 17a012d7 added a newline to the str, so the line built from str.length() is one character longer than it should be.