aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2014-03-03 11:11:10 +0100
committerIngela Anderton Andin <[email protected]>2014-03-04 10:51:10 +0100
commit9358afed5afdf9da8a19e325e32c1be4b723c705 (patch)
tree05583328a49793b948dd6abeb242a791ad0dcccb /lib/ssl/src
parenta74e66a68f3b4ed590f928b4fd4f0808c6287a32 (diff)
downloadotp-9358afed5afdf9da8a19e325e32c1be4b723c705.tar.gz
otp-9358afed5afdf9da8a19e325e32c1be4b723c705.tar.bz2
otp-9358afed5afdf9da8a19e325e32c1be4b723c705.zip
ssl: Add input sanity check
Avoid puzzling behavior due to options being disregarded if they are not key value tuples.
Diffstat (limited to 'lib/ssl/src')
-rw-r--r--lib/ssl/src/ssl.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl
index c3bdeb1a54..d46c05c5f3 100644
--- a/lib/ssl/src/ssl.erl
+++ b/lib/ssl/src/ssl.erl
@@ -557,6 +557,7 @@ do_connect(Address, Port,
handle_options(Opts0, _Role) ->
Opts = proplists:expand([{binary, [{mode, binary}]},
{list, [{mode, list}]}], Opts0),
+ assert_proplist(Opts),
ReuseSessionFun = fun(_, _, _, _) -> true end,
DefaultVerifyNoneFun =
@@ -1042,3 +1043,10 @@ connection_sup(dtls_connection) ->
binary_filename(FileName) ->
Enc = file:native_name_encoding(),
unicode:characters_to_binary(FileName, unicode, Enc).
+
+assert_proplist([]) ->
+ true;
+assert_proplist([{Key,_} | Rest]) when is_atom(Key) ->
+ assert_proplist(Rest);
+assert_proplist([Value | _]) ->
+ throw({option_not_a_key_value_tuple, Value}).