laforge has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo_ss7/+/36105?usp=email ) Change subject: ipa: fix empty IPA CCM ID Tags ...................................................................... ipa: fix empty IPA CCM ID Tags decode_ies() would crash because lists:lasts([]) tries to access an empty lists. Change-Id: I6f44561f83c84bac7e5c98747f969f5436617f90 --- M src/ipa_proto_ccm.erl 1 file changed, 18 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/ipa_proto_ccm.erl b/src/ipa_proto_ccm.erl index 27ceba9..87eb15e 100644 --- a/src/ipa_proto_ccm.erl +++ b/src/ipa_proto_ccm.erl @@ -82,9 +82,12 @@ decode_ies(<<0:8, Len:8, TypeValue:Len/binary, Remain/binary>>, IeList) when is_list(IeList) -> <<Type:8, Value/binary>> = TypeValue, ValueList = binary_to_list(Value), - case lists:last(ValueList) of - 0 -> ValueStripped = lists:droplast(ValueList); - _ -> ValueStripped = ValueList + case ValueList of + [] -> ValueStripped = []; + _ -> case lists:last(ValueList) of + 0 -> ValueStripped = lists:droplast(ValueList); + _ -> ValueStripped = ValueList + end end, decode_ies(Remain, IeList ++ [{string, decode_idtag(Type), ValueStripped}]). -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo_ss7/+/36105?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo_ss7 Gerrit-Branch: master Gerrit-Change-Id: I6f44561f83c84bac7e5c98747f969f5436617f90 Gerrit-Change-Number: 36105 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> Gerrit-MessageType: merged