[automerger skipped] Add buffer size checks to eliminate security vulnerability. am: 0fef164d3d -s ours am: 40c6e10c72 -s ours am: 9012bc5cec -s ours

am skip reason: Change-Id I5977e216bcaecd4ed10c0a991bed2860e6d627d9 with SHA-1 b800e578d8 is in history

Change-Id: Idaae4e386791636e67839767dd6406d88c448213