Integer overflow check in writes to session buffer

The current logic for writing to hoth blob session buffer can run into
out-of-bounds memory access when `data` and `offset` are controlled by
an attacker.

This change adds additional check to avoid the overflow (and hence the
out-of-bounds memory access). This change also moves handling for empty
`data` earlier in the code

Google-Bug-Id=517927802
Change-Id: Ib03fdb69d94e9820eac715544b84cf755cf754e5
Signed-off-by: Lovepreet Singh <lpsingh@google.com>
1 file changed