diff options
author | Hans Nilsson <[email protected]> | 2016-05-20 14:27:12 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2016-05-20 14:27:12 +0200 |
commit | dde2c0136a4091be04239808ea186821846f0343 (patch) | |
tree | c64046f58e2e6abf0a370d22774d2ce7f8d8bc2a /lib/ssh | |
parent | dca8194f0b17a34306451416f0d94cf3422c1f5d (diff) | |
download | otp-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.erl | 10 |
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, |