aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gtpv2.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2022-01-27 16:38:39 +0100
committerJaap Keuter <jaap.keuter@xs4all.nl>2022-01-27 18:08:34 +0000
commit33b000148fb32fd7ff2ec3677e84dccde478df1b (patch)
tree1003767ca274f0cbd372d41b2c500ef90d794fe2 /epan/dissectors/packet-gtpv2.c
parent1a512bc26d797628b50e03a062920ac9056b8dca (diff)
GTPv2: MM Context handle 0 length IEs
Diffstat (limited to 'epan/dissectors/packet-gtpv2.c')
-rw-r--r--epan/dissectors/packet-gtpv2.c64
1 files changed, 41 insertions, 23 deletions
diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c
index 71b02615bf..c84dbc9f04 100644
--- a/epan/dissectors/packet-gtpv2.c
+++ b/epan/dissectors/packet-gtpv2.c
@@ -1931,32 +1931,40 @@ dissect_gtpv2_mm_con_eutran_srvcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
proto_tree_add_item(tree, hf_gtpv2_iksrvcc, tvb, offset, 16, ENC_NA);
offset += 16;
+ /* For each of the Mobile Station Classmark 2, Mobile Station Classmark 3 and Supported Codec List parameters, if they are not available,
+ then the associated length field shall be set to zero, and the particular parameter field shall not be present.
+ */
/* Length of Mobile Station Classmark2 */
elm_len = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark2, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- fi = proto_tree_add_item(tree, hf_gtpv2_mobile_station_classmark2, tvb, offset, elm_len, ENC_NA);
- ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
- de_ms_cm_2(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
- offset += elm_len;
+ if (elm_len) {
+ fi = proto_tree_add_item(tree, hf_gtpv2_mobile_station_classmark2, tvb, offset, elm_len, ENC_NA);
+ ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
+ de_ms_cm_2(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
+ offset += elm_len;
+ }
/* Length of Mobile Station Classmark3 */
elm_len = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark3, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- fi = proto_tree_add_item(tree, hf_gtpv2_mobile_station_classmark3, tvb, offset, elm_len, ENC_NA);
- ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
- de_ms_cm_3(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
- offset += elm_len;
+ if (elm_len) {
+ fi = proto_tree_add_item(tree, hf_gtpv2_mobile_station_classmark3, tvb, offset, elm_len, ENC_NA);
+ ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
+ de_ms_cm_3(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
+ offset += elm_len;
+ }
/*Length of Supported Codec List */
elm_len = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_gtpv2_len_supp_codec_list, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- fi = proto_tree_add_item(tree, hf_gtpv2_supported_codec_list, tvb, offset, elm_len, ENC_NA);
- ms_tree = proto_item_add_subtree(fi, ett_gtpv2_supp_codec_list);
- de_sup_codec_list(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
-
+ if (elm_len) {
+ fi = proto_tree_add_item(tree, hf_gtpv2_supported_codec_list, tvb, offset, elm_len, ENC_NA);
+ ms_tree = proto_item_add_subtree(fi, ett_gtpv2_supp_codec_list);
+ de_sup_codec_list(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
+ }
}
/* 6.6 MM Context for UTRAN SRVCC */
@@ -1979,31 +1987,41 @@ dissect_gtpv2_mm_con_utran_srvcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
proto_tree_add_item(tree, hf_gtpv2_cksn, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
+ /* For each of the Mobile Station Classmark 2, Mobile Station Classmark 3 and Supported Codec List parameters, if they are not available,
+ then the associated length field shall be set to zero, and the particular parameter field shall not be present.
+ */
+
/*Length of Mobile Station Classmark2 */
elm_len = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark2, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- fi = proto_tree_add_item(tree, hf_gtpv2_mobile_station_classmark2, tvb, offset, elm_len, ENC_NA);
- ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
- de_ms_cm_2(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
- offset += elm_len;
+ if (elm_len) {
+ fi = proto_tree_add_item(tree, hf_gtpv2_mobile_station_classmark2, tvb, offset, elm_len, ENC_NA);
+ ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
+ de_ms_cm_2(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
+ offset += elm_len;
+ }
/*Length of Mobile Station Classmark3 */
elm_len = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark3, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- fi = proto_tree_add_item(tree, hf_gtpv2_mobile_station_classmark3, tvb, offset, elm_len, ENC_NA);
- ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
- de_ms_cm_3(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
- offset += elm_len;
+ if (elm_len) {
+ fi = proto_tree_add_item(tree, hf_gtpv2_mobile_station_classmark3, tvb, offset, elm_len, ENC_NA);
+ ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
+ de_ms_cm_3(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
+ offset += elm_len;
+ }
/*Length of Supported Codec List */
elm_len = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_gtpv2_len_supp_codec_list, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- fi = proto_tree_add_item(tree, hf_gtpv2_supported_codec_list, tvb, offset, elm_len, ENC_NA);
- ms_tree = proto_item_add_subtree(fi, ett_gtpv2_supp_codec_list);
- de_sup_codec_list(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
+ if (elm_len) {
+ fi = proto_tree_add_item(tree, hf_gtpv2_supported_codec_list, tvb, offset, elm_len, ENC_NA);
+ ms_tree = proto_item_add_subtree(fi, ett_gtpv2_supp_codec_list);
+ de_sup_codec_list(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
+ }
}