fixed out-of-bounds string access

Change-Id: I89e005f6f2d35e3343077b3b28e9fbb5135f9fff