fixed btoa() buffer overrun

Change-Id: Ibf0388e359239e7b027e2939c8a730c2743959a9