Avoid potential out of boundary buffer access issue. Change-Id: Ic3766cd5bc2c1c8b4e1cbf38310fe6689aa38b59