Permalink
Browse files

Merge pull request #2 from ates/master

One more fix related to decoding of SCTP
  • Loading branch information...
msantos committed Sep 10, 2012
2 parents ac9ec52 + 8598138 commit 2a8d511da93cd63104f6b0965715d37f61fe386d
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/pkt.erl
View
@@ -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,

0 comments on commit 2a8d511

Please sign in to comment.