Skip to content

Commit

Permalink
Fix decoding of SCTP chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
ates committed Sep 10, 2012
1 parent a597e56 commit 8598138
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pkt.erl
Expand Up @@ -365,8 +365,13 @@ sctp_decode_chunks(<<Type:8, Flags:8, Length:16, Rest/binary>>, Acc) ->
0 -> Length - 4;
Pad -> Length + (4 - Pad) - 4
end,
<<Payload:L/binary-unit:8, Tail/binary>> = Rest,
sctp_decode_chunks(Tail, [sctp_chunk(Type, Flags, L, Payload) | Acc]).
case Rest of
<<>> ->
Acc;
_ ->
<<Payload:L/binary-unit:8, Tail/binary>> = Rest,
sctp_decode_chunks(Tail, [sctp_chunk(Type, Flags, L, Payload) | Acc])
end.

sctp_chunk(Ctype, Cflags, Clen, Payload) ->
#sctp_chunk{type=Ctype, flags=Cflags, len = Clen-4,
Expand Down

0 comments on commit 8598138

Please sign in to comment.