diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-09-05 00:49:36 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-09-05 00:49:36 +0100 |
commit | 1d4c13c798639c925825c70150b138553f8dff49 (patch) | |
tree | 4357fd11e3eb8d22f2698df1a95a29ea1282b03e /javascript/olm_post.js | |
parent | 0c3f527dfd46d3056d5b3690836c102f0e0adfb4 (diff) |
Fix megolm decryption of UTF-8
Repeat the fix from b10f90d for megolm messages.
It turns out that the 'length' argument to 'Pointer_stringify' doesn't work if
the input includes characters >= 128.
Rather than try to figure out which methods can return UTF-8, and which always
return plain ascii, replace all uses of Pointer_stringify with a 'length'
argument with the version that expects a NULL-terminated input, and extend the
buffer by a byte to allow space for a null-terminator.
In the case of decrypt, we need to add the null ourself.
Fixes https://github.com/vector-im/vector-web/issues/2078.
Diffstat (limited to 'javascript/olm_post.js')
-rw-r--r-- | javascript/olm_post.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/javascript/olm_post.js b/javascript/olm_post.js index 955d68d..dac89f6 100644 --- a/javascript/olm_post.js +++ b/javascript/olm_post.js @@ -5,7 +5,7 @@ var Pointer_stringify = Module['Pointer_stringify']; var OLM_ERROR = Module['_olm_error'](); /* The 'length' argument to Pointer_stringify doesn't work if the input includes - * cahracters >= 128; we therefore need to add a NULL character to all of our + * characters >= 128; we therefore need to add a NULL character to all of our * strings. This acts as a symbolic constant to help show what we're doing. */ var NULL_BYTE_PADDING_LENGTH = 1; |