From 67f23547d28d4445222184b593e40822f1c150ba Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 21 Feb 2022 15:56:03 +0100 Subject: [PATCH] GTP_Codec_Port: Check length field of GTPV1C received packets Change-Id: Ie9447b7ec7f7f5ee35cd0393265f5edb5578bdaf --- library/GTP_CodecPort.ttcn | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/GTP_CodecPort.ttcn b/library/GTP_CodecPort.ttcn index 317210e15..b516611d3 100644 --- a/library/GTP_CodecPort.ttcn +++ b/library/GTP_CodecPort.ttcn @@ -14,6 +14,7 @@ module GTP_CodecPort { import from IPL4asp_Types all; import from GTPC_Types all; import from GTPU_Types all; + import from Misc_Helpers all; modulepar { SystemUnderTest mp_pl_SystemUnderTest := SGSN; @@ -63,6 +64,10 @@ module GTP_CodecPort { out_ud.peer.remName := in_ud.remName; out_ud.peer.remPort := in_ud.remPort; out_ud.gtpc := dec_PDU_GTPC(in_ud.msg, pl_SystemUnderTest := mp_pl_SystemUnderTest); + if (lengthof(in_ud.msg) != out_ud.gtpc.lengthf + 8) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Rx GTPv1-C with field length ", out_ud.gtpc.lengthf, " + 8 != exp ", lengthof(in_ud.msg))); + } } with { extension "prototype(fast)" };