aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-05-25 12:43:44 +0200
committerHans Nilsson <[email protected]>2016-05-25 12:43:44 +0200
commit2f2aeb528787a51380e0346965e98779481300b9 (patch)
tree5b2df90e1e5a84c48decb69929b6379e2ae6743e /lib
parent16e733bc6aa83bf0d2c86bcddb63095d9ed0cf3a (diff)
parentdde2c0136a4091be04239808ea186821846f0343 (diff)
downloadotp-2f2aeb528787a51380e0346965e98779481300b9.tar.gz
otp-2f2aeb528787a51380e0346965e98779481300b9.tar.bz2
otp-2f2aeb528787a51380e0346965e98779481300b9.zip
Merge branch 'hans/ssh/decode_error'
* hans/ssh/decode_error: ssh: handle ssh_message binary decode errors
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh/src/ssh_message.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh_message.erl b/lib/ssh/src/ssh_message.erl
index db80d4c9e3..562f040477 100644
--- a/lib/ssh/src/ssh_message.erl
+++ b/lib/ssh/src/ssh_message.erl
@@ -50,7 +50,15 @@
-define(Empint(X), (ssh_bits:mpint(X))/binary ).
-define(Ebinary(X), ?STRING(X) ).
--define(unicode_list(B), unicode:characters_to_list(B)).
+ucl(B) ->
+ try unicode:characters_to_list(B) of
+ L when is_list(L) -> L;
+ {error,_Matched,Rest} -> throw({error,{bad_unicode,Rest}})
+ catch
+ _:_ -> throw({error,bad_unicode})
+ end.
+
+-define(unicode_list(B), ucl(B)).
encode(#ssh_msg_global_request{
name = Name,