Skip to content

Commit

Permalink
Fix decode of SCTP INIT params
Browse files Browse the repository at this point in the history
  • Loading branch information
ates committed Jul 20, 2014
1 parent 09e65cb commit caa8da5
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/pkt_sctp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,9 @@ init_params(<<12:16, Length:16, Rest/binary>>, Acc) ->
(6) -> ipv6;
(11) -> hostname
end,
case Length rem 4 of
0 ->
<<Value:16, Tail/binary>> = Rest,
init_params(Tail, [{address_types, [AddressType(Value)]} | Acc]);
N ->
L = Length - 4,
<<Types:L/binary-unit:8, _Pad:N/binary-unit:8, Tail/binary>> = Rest,
init_params(Tail, [{address_types, [AddressType(V) || <<V:16>> <= Types]} | Acc])
end;
L = Length - 4,
<<Types:L/binary-unit:8, Tail/binary>> = Rest,
init_params(Tail, [{address_types, [AddressType(V) || <<V:16>> <= Types]} | Acc]);
%% Ignore ECN and Forward TSN parameters
init_params(_, Acc) -> Acc.

Expand Down

0 comments on commit caa8da5

Please sign in to comment.