Skip to content

Commit

Permalink
place the verification token at a random address
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jul 21, 2022
1 parent 516be64 commit c001342
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion xpra/client/mixins/mmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# later version. See the file COPYING for details.

import os
from random import randint

from xpra.util import envbool, typedict
from xpra.os_util import get_int_uuid
Expand Down Expand Up @@ -132,7 +133,7 @@ def init_mmap(self, mmap_filename, mmap_group, socket_filename):
if self.mmap_enabled:
self.mmap_token = get_int_uuid()
self.mmap_token_bytes = DEFAULT_TOKEN_BYTES
self.mmap_token_index = self.mmap_size - DEFAULT_TOKEN_BYTES
self.mmap_token_index = randint(0, self.mmap_size - DEFAULT_TOKEN_BYTES)
write_mmap_token(self.mmap, self.mmap_token, self.mmap_token_index, self.mmap_token_bytes)

def clean_mmap(self):
Expand Down
4 changes: 3 additions & 1 deletion xpra/server/source/mmap_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

from random import randint

from xpra.util import typedict
from xpra.server.source.stub_source_mixin import StubSourceMixin

Expand Down Expand Up @@ -109,7 +111,7 @@ def mmapattr(k):
from xpra.os_util import get_int_uuid
self.mmap_client_token = get_int_uuid()
self.mmap_client_token_bytes = DEFAULT_TOKEN_BYTES
self.mmap_client_token_index = self.mmap_size-self.mmap_client_token_bytes
self.mmap_client_token_index = randint(0, self.mmap_size-self.mmap_client_token_bytes)
write_mmap_token(self.mmap,
self.mmap_client_token,
self.mmap_client_token_index,
Expand Down

0 comments on commit c001342

Please sign in to comment.