Fix boundary check problems in socket_host.cc. See the bug for the full list of security issues fixed.

TBR=sergeyu@chromium.org
BUG=416528

Review URL: https://codereview.chromium.org/589183002

Cr-Commit-Position: refs/heads/master@{#296287}
(cherry picked from commit 08f0eac49f32b8d24c82bd5cc884938eb494f85e)

Review URL: https://codereview.chromium.org/607633002

Cr-Commit-Position: refs/branch-heads/2125@{#478}
Cr-Branched-From: b68026d94bda36dd106a3d91a098719f952a9477-refs/heads/master@{#290040}
3 files changed