FPII-2768: Check for bad packets in getaddrinfo.c's getanswer.

The near duplicate in gethnamaddr.c was already doing so (this fix
is basically copy and pasted from there, but with both copies modified
to avoid skirting undefined behavior).

(cherrypick of 27a4459d945e34fabd7166791a5b862ccea83f23 from master.)

Bug: http://b/32322088
Test: browser still works
Change-Id: I16950bb0ff9dc806cc5405b913ca4ef96e43c19f
(cherry picked from commit 9ea3f1c8a5280c99b5a315a06175dbce9d9296b7)
2 files changed