aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_post.js
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/olm_post.js')
-rw-r--r--javascript/olm_post.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/javascript/olm_post.js b/javascript/olm_post.js
index 3e80c0b..65eab02 100644
--- a/javascript/olm_post.js
+++ b/javascript/olm_post.js
@@ -335,6 +335,14 @@ Session.prototype['encrypt'] = restore_stack(function(
random, random_length,
message_buffer, message_length
);
+
+ // UTF8ToString requires a null-terminated argument, so add the
+ // null terminator.
+ Module['setValue'](
+ message_buffer+message_length,
+ 0, "i8"
+ );
+
return {
"type": message_type,
"body": Module['UTF8ToString'](message_buffer),