Correct maximum length

This commit is contained in:
Martin Sumner 2018-02-08 15:31:35 +00:00
parent 7e4c3db915
commit c7cea04aba

View file

@ -1519,11 +1519,11 @@ crc_check_slot(FullBin) ->
PosBL:32/integer,
CRC32H:32/integer,
Rest/binary>> = FullBin,
PosBL0 = min(PosBL, byte_size(FullBin) - 4),
PosBL0 = min(PosBL, byte_size(FullBin) - 3),
% If the position has been bit-flipped to beyond the maximum paossible
% length, use the maximum possible length
<<Header:PosBL0/binary, Blocks/binary>> = Rest,
case {hmac(Header), hmac(PosBL)} of
case {hmac(Header), hmac(PosBL0)} of
{CRC32H, CRC32PBL} ->
{Header, Blocks};
_ ->