Make sure packets are valid

Fixes CID 66408, 66409 and 72045