From 071029c20174307de28ca20232196f83fcc37763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 1 Apr 2019 17:40:43 +0200 Subject: javascript: Switch from deprecated Pointer_stringify() to UTF8toString(). The Pointer_stringify() function is deprecated and has a couple of issues because it tries to guess the encoding of the buffer. In some cases it can ignore the length parameter which could end up in inconsistencies. Switch to UTF8toString() that takes a length parameter and respects, that way we don't need to allocate an additional byte for a NULL byte. --- javascript/olm_pre.js | 8 -------- 1 file changed, 8 deletions(-) (limited to 'javascript/olm_pre.js') diff --git a/javascript/olm_pre.js b/javascript/olm_pre.js index 314d7da..7153f7a 100644 --- a/javascript/olm_pre.js +++ b/javascript/olm_pre.js @@ -30,14 +30,6 @@ if (typeof(OLM_OPTIONS) !== 'undefined') { } } -/* The 'length' argument to Pointer_stringify doesn't work if the input - * includes characters >= 128, which makes Pointer_stringify unreliable. We - * could use it on strings which are known to be ascii, but that seems - * dangerous. Instead we add a NULL character to all of our strings and just - * use UTF8ToString. - */ -var NULL_BYTE_PADDING_LENGTH = 1; - Module['onRuntimeInitialized'] = function() { OLM_ERROR = Module['_olm_error'](); olm_exports["PRIVATE_KEY_LENGTH"] = Module['_olm_pk_private_key_length'](); -- cgit v1.2.3