Setting the valid length of the shared buffer.