From 2666b68aab2167266f49b462e3ed63e6f2045709 Mon Sep 17 00:00:00 2001 From: Simon Cornish Date: Wed, 2 Dec 2009 12:12:40 -0800 Subject: [PATCH] Correctly type sctp_assoc_id as signed, not unsigned The underlying type of an SCTP association ID is a signed 32-bit integer on common platforms (Solaris, Linux & Mac OS/X NKE). The SCTP socket API draft spec (draft-ietf-tsvwg-sctpsocket-19) defines only one special value, zero. Although particular platform implementations may impose other restrictions, the type check in prim_inet should allow all valid values. --- erts/preloaded/src/prim_inet.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl index 0feb591efb8e..d164f451ee6f 100644 --- a/erts/preloaded/src/prim_inet.erl +++ b/erts/preloaded/src/prim_inet.erl @@ -1340,7 +1340,7 @@ type_value_2(binary_or_uint,Bin) when is_binary(Bin) -> true; type_value_2(binary_or_uint,Int) when is_integer(Int), Int >= 0 -> true; %% Type-checking of SCTP options type_value_2(sctp_assoc_id, X) - when X band 16#ffffffff =:= X -> true; + when is_integer(X), X >= -2147483648, X =< 2147483647 -> true; type_value_2(_, _) -> false.