aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-05-20 14:27:12 +0200
committerHans Nilsson <[email protected]>2016-05-20 14:27:12 +0200
commitdde2c0136a4091be04239808ea186821846f0343 (patch)
treec64046f58e2e6abf0a370d22774d2ce7f8d8bc2a /lib/ssh
parentdca8194f0b17a34306451416f0d94cf3422c1f5d (diff)
downloadotp-dde2c0136a4091be04239808ea186821846f0343.tar.gz
otp-dde2c0136a4091be04239808ea186821846f0343.tar.bz2
otp-dde2c0136a4091be04239808ea186821846f0343.zip
ssh: handle ssh_message binary decode errors
Diffstat (limited to 'lib/ssh')
-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,