Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
matrix-org
Olm
Commits
819f0d24
Commit
819f0d24
authored
Dec 16, 2016
by
Richard van der Hoff
Committed by
GitHub
Dec 16, 2016
Browse files
Merge pull request #40 from matrix-org/rav/fix_encryption
Avoid buffer overrun on encryption
parents
7fd63bca
8e554ab5
Changes
2
Show whitespace changes
Inline
Side-by-side
javascript/olm_outbound_group_session.js
View file @
819f0d24
...
...
@@ -83,6 +83,14 @@ OutboundGroupSession.prototype['encrypt'] = function(plaintext) {
plaintext_buffer
,
plaintext_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
Module
[
'
UTF8ToString
'
](
message_buffer
);
}
finally
{
if
(
plaintext_buffer
!==
undefined
)
{
...
...
javascript/olm_post.js
View file @
819f0d24
...
...
@@ -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
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment