diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/wallet/emscriptif.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/wallet/emscriptif.ts b/lib/wallet/emscriptif.ts index 9a1d902c0..5879300e7 100644 --- a/lib/wallet/emscriptif.ts +++ b/lib/wallet/emscriptif.ts @@ -665,9 +665,9 @@ export class ByteArray extends PackedArenaObject { } static fromCrock(s: string, a?: Arena): ByteArray { - let byteLength = countBytes(s) + 1; - let hstr = emscAlloc.malloc(byteLength); - Module.stringToUTF8(s, hstr, byteLength); + let byteLength = countBytes(s); + let hstr = emscAlloc.malloc(byteLength + 1); + Module.stringToUTF8(s, hstr, byteLength + 1); let decodedLen = Math.floor((byteLength * 5) / 8); let ba = new ByteArray(decodedLen, undefined, a); let res = emsc.string_to_data(hstr, byteLength, ba.nativePtr, decodedLen); |