diff options
author | Lukas Larsson <[email protected]> | 2017-05-23 15:14:36 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2017-05-23 15:14:36 +0200 |
commit | 14c54f82e0279f6e6dcdf9ed281f0236c441220a (patch) | |
tree | 92ac7258df8d0141f527e988a953e626fad7b3f8 /lib/kernel | |
parent | c633554de7dfa2f34a0eaeabfb2922836583ef8e (diff) | |
parent | 2fa8ade78ef987ad1f3ab42bed691ebfcf29d29d (diff) | |
download | otp-14c54f82e0279f6e6dcdf9ed281f0236c441220a.tar.gz otp-14c54f82e0279f6e6dcdf9ed281f0236c441220a.tar.bz2 otp-14c54f82e0279f6e6dcdf9ed281f0236c441220a.zip |
Merge branch 'lukas/kernel/distribution_early_reject/OTP-14426'
* lukas/kernel/distribution_early_reject/OTP-14426:
kernel: Add early reject of invalid node names
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/src/dist_util.erl | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/kernel/src/dist_util.erl b/lib/kernel/src/dist_util.erl index 1c326afca8..b3507e5d13 100644 --- a/lib/kernel/src/dist_util.erl +++ b/lib/kernel/src/dist_util.erl @@ -572,12 +572,25 @@ recv_name(#hs_data{socket = Socket, f_recv = Recv}) -> ?shutdown(no_node) end. -get_name([$n,VersionA, VersionB, Flag1, Flag2, Flag3, Flag4 | OtherNode]) -> - {?u32(Flag1, Flag2, Flag3, Flag4), list_to_atom(OtherNode), - ?u16(VersionA,VersionB)}; +get_name([$n,VersionA, VersionB, Flag1, Flag2, Flag3, Flag4 | OtherNode] = Data) -> + case is_valid_name(OtherNode) of + true -> + {?u32(Flag1, Flag2, Flag3, Flag4), list_to_atom(OtherNode), + ?u16(VersionA,VersionB)}; + false -> + ?shutdown(Data) + end; get_name(Data) -> ?shutdown(Data). +is_valid_name(OtherNodeName) -> + case string:lexemes(OtherNodeName,"@") of + [_OtherNodeName,_OtherNodeHost] -> + true; + _else -> + false + end. + publish_type(Flags) -> case Flags band ?DFLAG_PUBLISHED of 0 -> |