Do a bunch more length checking.

Make sure we don't run past the end of the packet or, when processing
the packet header, run past the end of the header.