Make sure packets are valid

Fixes CID 66408, 66409 and 72045
Merge pull request #1368 from mc-server/coverityFixes

Make sure packets are valid