Fix a possible buffer overflow.
Bump version to 1.0.5.