Don't read more than the buffer size. am: 2f5f0ace27
am: c5baeace1b

Change-Id: Ifb21761dfd26885a396bd74fb2c4eef7c4c4f1f2