Fixed segfaults in the tests where snprintf would write out of bounds.