Surely it's sufficient for our buffer to be big enough to hold length+1 bytes ?