Use StringValueCStr instead of StringValuePtr to make sure to terminate by NUL character.