Skip to content

Commit

Permalink
Fix padding calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ates committed Sep 6, 2012
1 parent bdde4b5 commit f2244e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pkt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ sctp_decode_chunks(<<>>, Acc) ->
sctp_decode_chunks(<<Type:8, Flags:8, Length:16, Rest/binary>>, Acc) ->
L = case Length rem 4 of
0 -> Length - 4;
Pad -> Length + Pad - 4
Pad -> Length + (4 - Pad) - 4
end,
<<Payload:L/binary-unit:8, Tail/binary>> = Rest,
sctp_decode_chunks(Tail, [sctp_chunk(Type, Flags, Length, Payload) | Acc]).
sctp_decode_chunks(Tail, [sctp_chunk(Type, Flags, L, Payload) | Acc]).

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

0 comments on commit f2244e5

Please sign in to comment.