Skip to content

Commit

Permalink
Correctly type sctp_assoc_id as signed, not unsigned
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dotsimon authored and bjorng committed Dec 3, 2009
1 parent 856e8f2 commit 2666b68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion erts/preloaded/src/prim_inet.erl
Expand Up @@ -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.


Expand Down

0 comments on commit 2666b68

Please sign in to comment.