diff options
author | Rickard Green <[email protected]> | 2017-10-12 17:05:02 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2017-10-12 17:05:02 +0200 |
commit | 5dc3cc971a7ce8d5384019a9a6f14a9ab7790163 (patch) | |
tree | b7e4befb7b193bdbf466a58e9de379edad5cdbf1 /lib/kernel/test | |
parent | 35d9fcedf1cc450ca36d95e9b8263fbc3e3a9b57 (diff) | |
parent | bb0b43eae854125688f3143e53c8974cafed4ad2 (diff) | |
download | otp-5dc3cc971a7ce8d5384019a9a6f14a9ab7790163.tar.gz otp-5dc3cc971a7ce8d5384019a9a6f14a9ab7790163.tar.bz2 otp-5dc3cc971a7ce8d5384019a9a6f14a9ab7790163.zip |
Merge branch 'rickard/null-chars/ERL-370/OTP-14543'
* rickard/null-chars/ERL-370/OTP-14543:
Don't allow null chars in various strings
Conflicts:
erts/emulator/beam/erl_alloc.types
erts/preloaded/ebin/erlang.beam
Diffstat (limited to 'lib/kernel/test')
-rw-r--r-- | lib/kernel/test/file_name_SUITE.erl | 2 | ||||
-rw-r--r-- | lib/kernel/test/os_SUITE.erl | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/kernel/test/file_name_SUITE.erl b/lib/kernel/test/file_name_SUITE.erl index 899102c908..f23529fec9 100644 --- a/lib/kernel/test/file_name_SUITE.erl +++ b/lib/kernel/test/file_name_SUITE.erl @@ -302,7 +302,9 @@ check_normal(Mod) -> {ok, BC} = Mod:read(FD,1024), ok = file:close(FD) end || {regular,Name,Content} <- NormalDir ], + {error, badarg} = Mod:rename("fil1\0tmp_fil2","tmp_fil1"), Mod:rename("fil1","tmp_fil1"), + {error, badarg} = Mod:read_file("tmp_fil1\0.txt"), {ok, <<"fil1">>} = Mod:read_file("tmp_fil1"), {error,enoent} = Mod:read_file("fil1"), Mod:rename("tmp_fil1","fil1"), diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl index 53a9e168ef..8056321448 100644 --- a/lib/kernel/test/os_SUITE.erl +++ b/lib/kernel/test/os_SUITE.erl @@ -22,7 +22,8 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2,end_per_testcase/2]). --export([space_in_cwd/1, quoting/1, cmd_unicode/1, space_in_name/1, bad_command/1, +-export([space_in_cwd/1, quoting/1, cmd_unicode/1, + null_in_command/1, space_in_name/1, bad_command/1, find_executable/1, unix_comment_in_command/1, deep_list_command/1, large_output_command/1, background_command/0, background_command/1, message_leak/1, close_stdin/0, close_stdin/1, perf_counter_api/1]). @@ -34,7 +35,8 @@ suite() -> {timetrap,{minutes,1}}]. all() -> - [space_in_cwd, quoting, cmd_unicode, space_in_name, bad_command, + [space_in_cwd, quoting, cmd_unicode, null_in_command, + space_in_name, bad_command, find_executable, unix_comment_in_command, deep_list_command, large_output_command, background_command, message_leak, close_stdin, perf_counter_api]. @@ -125,6 +127,14 @@ cmd_unicode(Config) when is_list(Config) -> [] = receive_all(), ok. +null_in_command(Config) -> + {Ok, Error} = case os:type() of + {win32,_} -> {"dir", "di\0r"}; + _ -> {"ls", "l\0s"} + end, + true = is_list(try os:cmd(Ok) catch Class0:_ -> Class0 end), + error = try os:cmd(Error) catch Class1:_ -> Class1 end, + ok. %% Test that program with a space in its name can be executed. space_in_name(Config) when is_list(Config) -> |