Fix sanitize error

Change List:
 add index check to fix buffer overflow problems reported by sanitize addresser