Fix heap buffer overflow issue flagged by fuzzer test.

OOB read occurs when the buffer index to be read is greater than the buffer size. Adding a check on buffer bounds fixes the issue.
Similar checks have been added wherever applicable on other such methods of the class.

Bug: 243400841
Test: Build mtp_data_packet_fuzzer and run on the target device

Change-Id: Ic3c0030d60a0e068aa5ddec6aa544bed5ba0ef8e
1 file changed