aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/test/systools_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-04-19 11:43:29 +0200
committerBjörn Gustavsson <[email protected]>2017-04-19 11:43:29 +0200
commitb5b5a7f7469bd041959d4b48e4eeff49faa7f377 (patch)
treea607300c1cbc2c7ea66eaf6e96494b1e0467d149 /lib/sasl/test/systools_SUITE.erl
parent6124bfc9b61227a5e82f1d7273d0895e909aac6e (diff)
parent05f20a9790fa88011c1ce7099e0a660aa83195a9 (diff)
downloadotp-b5b5a7f7469bd041959d4b48e4eeff49faa7f377.tar.gz
otp-b5b5a7f7469bd041959d4b48e4eeff49faa7f377.tar.bz2
otp-b5b5a7f7469bd041959d4b48e4eeff49faa7f377.zip
Merge branch 'bjorn/stdlib/erl_tar/OTP-14278'
* bjorn/stdlib/erl_tar/OTP-14278: erl_tar: Handle leading slashes and directory traversal attacks Don't create absolute path names in tar files
Diffstat (limited to 'lib/sasl/test/systools_SUITE.erl')
-rw-r--r--lib/sasl/test/systools_SUITE.erl16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sasl/test/systools_SUITE.erl b/lib/sasl/test/systools_SUITE.erl
index 0c98232467..1a8bd3f607 100644
--- a/lib/sasl/test/systools_SUITE.erl
+++ b/lib/sasl/test/systools_SUITE.erl
@@ -87,25 +87,25 @@ end_per_group(_GroupName, Config) ->
init_per_suite(Config) when is_list(Config) ->
+ %% To use in end_per_testcase
+ Path = code:get_path(),
+ {ok,Cwd} = file:get_cwd(),
+
%% Make of copy of the data directory.
DataDir = ?datadir,
PrivDir = ?privdir,
CopyDir = fname(PrivDir, "datacopy"),
+ ok = file:make_dir(CopyDir),
TarFile = fname(PrivDir, "datacopy.tgz"),
- {ok, Tar} = erl_tar:open(TarFile, [write, compressed]),
- ok = erl_tar:add(Tar, DataDir, CopyDir, [compressed]),
- ok = erl_tar:close(Tar),
- ok = erl_tar:extract(TarFile, [compressed]),
+ ok = file:set_cwd(DataDir),
+ ok = erl_tar:create(TarFile, ["."], [compressed]),
+ ok = erl_tar:extract(TarFile, [compressed, {cwd,CopyDir}]),
ok = file:delete(TarFile),
%% Compile source files in the copy directory.
Sources = filelib:wildcard(fname([CopyDir,'*','*','*','*','*.erl'])),
lists:foreach(fun compile_source/1, Sources),
- %% To use in end_per_testcase
- Path = code:get_path(),
- {ok,Cwd} = file:get_cwd(),
-
[{copy_dir, CopyDir}, {cwd,Cwd}, {path,Path} | Config].
compile_source(File) ->