Account for null byte in string length (resolves issue #833)