Fix panic when packet is too short.