diff options
Diffstat (limited to 'javascript/olm_inbound_group_session.js')
-rw-r--r-- | javascript/olm_inbound_group_session.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/javascript/olm_inbound_group_session.js b/javascript/olm_inbound_group_session.js index dd8e493..423d2b1 100644 --- a/javascript/olm_inbound_group_session.js +++ b/javascript/olm_inbound_group_session.js @@ -8,7 +8,7 @@ function inbound_group_session_method(wrapped) { return function() { var result = wrapped.apply(this, arguments); if (result === OLM_ERROR) { - var message = Pointer_stringify( + var message = UTF8ToString( Module['_olm_inbound_group_session_last_error'](arguments[0]) ); throw new Error("OLM." + message); @@ -40,7 +40,7 @@ InboundGroupSession.prototype['pickle'] = restore_stack(function(key) { key_array[i] = 0; } } - return Pointer_stringify(pickle_buffer); + return UTF8ToString(pickle_buffer, pickle_length); }); InboundGroupSession.prototype['unpickle'] = restore_stack(function(key, pickle) { @@ -132,7 +132,7 @@ InboundGroupSession.prototype['decrypt'] = restore_stack(function( ); return { - "plaintext": UTF8ToString(plaintext_buffer), + "plaintext": UTF8ToString(plaintext_buffer, plaintext_length), "message_index": getValue(message_index, "i32") } } finally { @@ -141,7 +141,7 @@ InboundGroupSession.prototype['decrypt'] = restore_stack(function( } if (plaintext_buffer !== undefined) { // don't leave a copy of the plaintext in the heap. - bzero(plaintext_buffer, plaintext_length + NULL_BYTE_PADDING_LENGTH); + bzero(plaintext_buffer, plaintext_length); free(plaintext_buffer); } } @@ -155,7 +155,7 @@ InboundGroupSession.prototype['session_id'] = restore_stack(function() { inbound_group_session_method(Module['_olm_inbound_group_session_id'])( this.ptr, session_id, length ); - return Pointer_stringify(session_id); + return UTF8ToString(session_id, length); }); InboundGroupSession.prototype['first_known_index'] = restore_stack(function() { @@ -172,7 +172,7 @@ InboundGroupSession.prototype['export_session'] = restore_stack(function(message outbound_group_session_method(Module['_olm_export_inbound_group_session'])( this.ptr, key, key_length, message_index ); - var key_str = Pointer_stringify(key); + var key_str = UTF8ToString(key, key_length); bzero(key, key_length); // clear out a copy of the key return key_str; }); |