Pascal-style strings have the length stored in the first byte, so a string can only be 255 characters long. Netstrings have the length in text at the front of the string instead, so you need only preallocate a buffer of 20 characters to store the text representation of string lengths up to 2^64 bytes.