Read and validate full packet header before realocating read buffer
Currently, the buffer is reallocated based on the full sized of the packet (first 4 bytes). This cause a problem when a tls client try to connect to a clear server.
A packet should be invalidated if its header is incoherent before the buffer is reallocated.