Check length before retrieving 2 byte int
Use a static buffer for the protocol headers