File tree Expand file tree Collapse file tree 5 files changed +21
-0
lines changed
tests/integration/archive/tar Expand file tree Collapse file tree 5 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ version https://git-lfs.github.com/spec/v1
2+ oid sha256:8b5233dfb3a4a23a3bf291bfff8ccfb371fbb2136cb093247d30af090d1e4276
3+ size 10240
Original file line number Diff line number Diff line change 1+ version https://git-lfs.github.com/spec/v1
2+ oid sha256:bd002ebcec73917b4294602e2999809e4119f5209a74f92fc0f70bff838bca69
3+ size 10240
Original file line number Diff line number Diff line change 1+ version https://git-lfs.github.com/spec/v1
2+ oid sha256:303980bcb9e9e6cdec515230791af8b0ab1aaa244b58a8d99152673aa22197d0
3+ size 6
Original file line number Diff line number Diff line change 1+ version https://git-lfs.github.com/spec/v1
2+ oid sha256:303980bcb9e9e6cdec515230791af8b0ab1aaa244b58a8d99152673aa22197d0
3+ size 6
Original file line number Diff line number Diff line change 99logger = get_logger ()
1010
1111RUNNING_AS_ROOT = os .getuid () == 0
12+ MAX_PATH_LEN = 255
1213
1314
1415class SafeTarFile (TarFile ):
@@ -18,6 +19,14 @@ def extract(
1819 path_as_path = Path (str (path ))
1920 member_name_path = Path (str (member .name ))
2021
22+ if not member .name :
23+ logger .warning ("File with empty filename in tar archive. Skipping" )
24+ return
25+
26+ if len (member .name ) > MAX_PATH_LEN :
27+ logger .warning ("File with filename too long in tar archive. Skipping" )
28+ return
29+
2130 if not RUNNING_AS_ROOT and (member .ischr () or member .isblk ()):
2231 logger .warning (
2332 "missing elevated permissions, skipping block and character device creation" ,
You can’t perform that action at this time.
0 commit comments