diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-27 14:53:22 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-27 14:55:47 +0300 |
commit | aba2d524a3aa1bfdd00e096fc89d75edb395cbe4 (patch) | |
tree | e16dba7b5a01d539fd584e23052469a32761ea01 /io_scene_fbx/import_fbx.py | |
parent | efc0fa6c4d9f21f9c5b4a12b8b30db6ef736a200 (diff) |
Fix potential issues with absolute-like paths in expected-relative properties.
Relative filepath having a 'absolute look' (starting with a path
separator) can lead to recursively checking for the whole root!
This is nasty, so try to avoid it by making relative paths actually
relative.
Based on D5143 (report and patch) by andreas atteneder (@atti), thanks!
Diffstat (limited to 'io_scene_fbx/import_fbx.py')
-rw-r--r-- | io_scene_fbx/import_fbx.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py index 5957f837..d94a237c 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -1408,6 +1408,8 @@ def blen_read_texture_image(fbx_tmpl, fbx_obj, basedir, settings): # Aaaaaaaarrrrrrrrgggggggggggg!!!!!!!!!!!!!! filepath = elem_find_first_string(fbx_obj, b'RelativeFilename') if filepath: + # Make sure we do handle a relative path, and not an absolute one (see D5143). + filepath = filepath.lstrip(os.path.sep).lstrip(os.path.altsep) filepath = os.path.join(basedir, filepath) else: filepath = elem_find_first_string(fbx_obj, b'FileName') |