Skip to content

Commit

Permalink
Improve vfs escape error message
Browse files Browse the repository at this point in the history
  • Loading branch information
AeonLucid committed Sep 2, 2021
1 parent b90fedd commit 81c8910
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/androidemu/vfs/file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ def translate_path(self, filename):

file_path = posixpath.join(self._root_path, filename)
file_path = posixpath.normpath(file_path)
common_path = posixpath.commonpath([file_path, self._root_path])

if posixpath.commonpath([file_path, self._root_path]) != self._root_path:
raise RuntimeError("Emulated binary tried to escape vfs jail.")
if common_path != self._root_path:
raise RuntimeError("Emulator tried to read outside vfs ('%s' != '%s')." % (common_path, self._root_path))

return file_path

Expand Down

0 comments on commit 81c8910

Please sign in to comment.