PactRecord allocating too few memory when writing UTF encoded strings

PactRecord serializes UTF strings by writing the size of the encoded string (2 bytes) and the actual data.
The current code correctly checks whether size+data actually fit in memory, but it only allocates the memory for the data, not the 2 size bytes.