Fix MemoryError when string is large

If a large string is read in then calling values.split caused
a MemoryError. Even if that is caught, the python internal state became
unusable. This patch avoids the problem by only reading up to the null
byte.